Currently a public list can only be deleted by its owner.
This means lists can exist infinitely.
This will introduce a new permission for list. With this permission, a
staff member will be allow to delete any public lists.
Test plan:
1/ Add the manage_shelves permission to a patron.
2/ Login with this patron
3/ Go on the public list view
4/ You should be able to edit all public lists
Followed test plan. Works as expected.
Signed-off-by: Marc Veron <veron@veron.ch>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
use warnings;
use Carp;
+use C4::Auth;
use C4::Context;
use C4::Debug;
+use C4::Members;
use constant SHELVES_MASTHEAD_MAX => 10; #number under Lists button in masthead
use constant SHELVES_COMBO_MAX => 10; #add to combo in search
return 0 unless defined($shelfnumber);
+ if ( $user > 0 ) {
+ my $borrower = C4::Members::GetMember( borrowernumber => $user );
+ return 1
+ if C4::Auth::haspermission( $borrower->{userid}, { shelves => 'manage_shelves' } );
+ }
+
my $dbh = C4::Context->dbh;
my $query = qq/
SELECT COALESCE(owner,0) AS owner, category, allow_add, allow_delete_own, allow_delete_other, COALESCE(sh.borrowernumber,0) AS borrowernumber
(16,'reports','Allow access to the reports module',0),
(17,'staffaccess','Allow staff members to modify permissions for other staff members',0),
(18,'coursereserves','Course reserves',0),
-(19, 'plugins', 'Koha plugins', '0');
+(19, 'plugins', 'Koha plugins', '0'),
+(20, 'shelves', 'Virtual shelves', 0)
+;
(19, 'manage', 'Manage plugins ( install / uninstall )'),
(19, 'tool', 'Use tool plugins'),
(19, 'report', 'Use report plugins'),
- (19, 'configure', 'Configure plugins')
+ (19, 'configure', 'Configure plugins'),
+ (20, 'manage_shelves', 'Manage shelves')
;
SetVersion ($DBversion);
}
+$DBversion = "3.19.00.XXX";
+if ( CheckVersion($DBversion) ) {
+ $dbh->do(q|
+ INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES
+ (20, 'shelves', 'Virtual shelves', 0)
+ |);
+ $dbh->do(q|
+ INSERT INTO permissions (module_bit, code, description) VALUES
+ (20, 'manage_shelves', 'Manage shelves')
+ |);
+ print "Upgrade to $DBversion done (Bug 13417: Add permission to manage shelves)\n";
+ SetVersion ($DBversion);
+}
+
=head1 FUNCTIONS
=head2 TableExists($table)