Bugzilla – Attachment 60364 Details for
Bug 10679
Lists interface offers delete option when user doesn't have permission
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10679: Hide delete option for lists if user does not have permission and has not added any items to that list
Bug-10679-Hide-delete-option-for-lists-if-user-doe.patch (text/plain), 2.15 KB, created by
Aleisha Amohia
on 2017-02-16 20:43:55 UTC
(
hide
)
Description:
Bug 10679: Hide delete option for lists if user does not have permission and has not added any items to that list
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2017-02-16 20:43:55 UTC
Size:
2.15 KB
patch
obsolete
>From 61ca5092c437c53ebb7b3fdefd0e761f4c5c1ff8 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 16 Feb 2017 20:14:13 +0000 >Subject: [PATCH] Bug 10679: Hide delete option for lists if user does not have > permission and has not added any items to that list > >Taking from Comment 5, if a list once had permissions for people to add >and remove entries, but then later the owner changes it so that others >can no longer add entries, users should be able to delete the entries >they added previously. > >This patch checks that the logged in user is the same account as the >borrower who added the entry to the list. If they are, the button to >remove should show. Attempting to delete any records they did not add >will fail, but attempting to delete the records they did add will >succeed. If they did not add any records to a list, the button to remove >will not show. > >To test: >1) Make TWO public lists. Set all permissions to 'Allow' on one list and >all permissions to 'Do not allow' on the other list. >2) Add one or two items to both lists. >3) Log in as a different user. Add one or two items to the list that you >have permission to add to. >4) Log back in as the original user and set all permissions on the >'Allow' list to 'Do not allow' >5) Log back in as the different user. Go to the list you added entries >to >6) The button to remove should show and you should be able to delete >your entries only. >7) There should be no button to remove on the other list that you have >added nothing to. > >Sponsored-by: Catalyst IT >--- > Koha/Virtualshelf.pm | 6 ++++++ > 1 file changed, 6 insertions(+) > >diff --git a/Koha/Virtualshelf.pm b/Koha/Virtualshelf.pm >index 4e45c31..e1e2c25 100644 >--- a/Koha/Virtualshelf.pm >+++ b/Koha/Virtualshelf.pm >@@ -273,6 +273,12 @@ sub can_biblios_be_removed { > and ( $self->owner == $borrowernumber > or $self->allow_delete_own > or $self->allow_delete_other ); >+ my @shelf_contents = Koha::Virtualshelfcontents->search({ shelfnumber => $self->shelfnumber }); >+ foreach my $item ( @shelf_contents ) { >+ if ( $item->borrowernumber == $borrowernumber ) { >+ return 1; >+ } >+ } > return 0; > } > >-- >2.1.4
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 10679
:
60228
| 60364