From 044ee24372a8ad16a676c00f77d20a53b00a62c2 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 15 Feb 2017 00:56:26 +0000 Subject: [PATCH] Bug 10679: Hide delete option for lists if user does not have permission The reason the delete button was still showing is because, by default, we allow anyone to remove THEIR OWN contributions from a list. So, the delete button will always show. This patch makes sure that the delete button will only show if permission for anyone else to add or delete their own entries is granted. To test: 1) Make a public list setting all permissions to 'do not allow' EXCEPT 'remove own contributed entries' (set this to Allow). This should be done by default, but just make sure 2) Log in as a different user and go to that list. notice the 'remove selected' button shows, but attempting to delete any records fails. 3) Apply patch and refresh the page 4) Notice that the delete button is now gone. 5) Log back in as the list owner and set the first two permissions to 'Allow' (add entries, remove their own contributed entries) 6) Log back in as a different user and go to the list. The delete button should now be showing and work as expected. Sponsored-by: Catalyst IT --- Koha/Virtualshelf.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Virtualshelf.pm b/Koha/Virtualshelf.pm index 4e45c31..b1a8793 100644 --- a/Koha/Virtualshelf.pm +++ b/Koha/Virtualshelf.pm @@ -271,7 +271,7 @@ sub can_biblios_be_removed { return 1 if $borrowernumber and ( $self->owner == $borrowernumber - or $self->allow_delete_own + or ( $self->allow_delete_own and $self->allow_add ) or $self->allow_delete_other ); return 0; } -- 2.1.4