Bugzilla – Attachment 18206 Details for
Bug 10277
Add C4::Context->IsSuperLibrarian()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10277 - Add C4::Context->IsSuperLibrarian()
Bug-10277---Add-C4Context-IsSuperLibrarian.patch (text/plain), 1.09 KB, created by
Kyle M Hall (khall)
on 2013-05-17 15:02:02 UTC
(
hide
)
Description:
Bug 10277 - Add C4::Context->IsSuperLibrarian()
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-05-17 15:02:02 UTC
Size:
1.09 KB
patch
obsolete
>From 3ce9301cca58f6e5b7c3f514536be3baa5689b96 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 15 May 2013 11:04:07 -0400 >Subject: [PATCH] Bug 10277 - Add C4::Context->IsSuperLibrarian() > >The method of checking the logged in user for superlibrarian privileges >is obtuse ( $userenv && $userenv->{flags} % 2 != 1 ) to say the least. >The codebase is littered with these lines, with no explanation given. It >would be much better if we had one subroutine that returned a boolean >value to tell us if the logged in user is a superlibrarian or not. >--- > C4/Context.pm | 14 ++++++++++++++ > 1 files changed, 14 insertions(+), 0 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 7709f7e..db0d498 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -1228,6 +1228,20 @@ sub tz { > } > > >+=head2 IsSuperLibrarian >+ >+ C4::Context->IsSuperlibrarian(); >+ >+=cut >+ >+sub IsSuperLibrarian { >+ if ( C4::Context->userenv ) { >+ return C4::Context->userenv->{flags} % 2 == 1; >+ } >+ else { >+ confess("C4::Context->userenv not defined!"); >+ } >+} > > 1; > __END__ >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10277
:
18206
|
18421
|
18422
|
18425
|
18427
|
18518
|
19229
|
20776
|
21144
|
23479
|
23480
|
23481
|
23482
|
23518
|
23523
|
23634
|
23635
|
23860
|
23861