https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26383 --- Comment #6 from David Cook <dcook@prosentient.com.au> --- (In reply to Jonathan Druart from comment #3)
I am not convinced here, we may want to replace it from .pl but keep C4::Context->IsSuperLibrarian for modules. Then we are not able to remove it and still use the code in two places.
Any suggestions?
Another option could be something like this: my $is_superlibrarian = Koha::Auth->is_superlibrarian({ borrowernumber => $borrowernumber, }); my $is_superlibrarian = Koha::Auth->is_superlibrarian({ patron => $patron, }); The only downside of that would be needing to add "use Koha::Auth", although I suppose we could add that into C4::Auth, which is called in the .pl scripts because they need the "get_template_and_user" function. Alternatively, you could write Koha::Patron->is_superlibrarian to be used as either a class method or an object method. You just check whether $self is a string or a reference to an object. If it's a class method (ie $self is a string), you could require a "patron" or "borrowernumber" parameter. That way you're keeping the code in one place but you're allowing for 2 different ways of calling it. There's some ideas :D -- You are receiving this mail because: You are watching all bug changes.