Bug 33363

Summary: More specific permissions for purchase suggestions
Product: Koha Reporter: Donna <bwsdonna>
Component: AcquisitionsAssignee: Kyle M Hall <kyle>
Status: Signed Off --- QA Contact: Martin Renvoize <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: dbarden, jbalway, jonathan.druart, jzairo, kbecker, kebliss, kkrueger, kyle, lisette.scheer, m.de.rooy, martin.renvoize, michaela.sieber, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 33363: Add separate permissions for creating and deleting suggestions
Bug 33363: Add separate permissions for creating and deleting suggestions
Bug 33363: Add separate permissions for creating and deleting suggestions
Bug 33363: Add separate permissions for creating and deleting suggestions
Bug 33363: Add unit tests
Bug 33363: Add separate permissions for creating and deleting suggestions
Bug 33363: Add unit tests
Bug 33363: Add separate permissions for creating and deleting suggestions
Bug 33363: Add unit tests

Description Donna 2023-03-29 19:25:36 UTC
There are a number of libraries that would like for their staff to be able to submit (and view existing) purchase suggestions from the borrower record, but not give the staff the ability to edit/manage/delete purchase suggestions.  

Currently if staff are given Suggestions Management/Manage Purchase Suggestions, and no Acq permissions, they are able to not only submit/view from the borrower record, but also access the purchase suggestion module and update/approve/delete purchase suggestions.  If Suggestions Management is not turned on, then staff cannot enter a purchase suggestion from a borrower record, nor can they see them from the patron record to let the patron know what the status is.

It would be helpful to have an addition permission level that would allow staff to enter a purchase suggestion from the borrower record, and view the existing purchase suggestions on a patron account.
Comment 1 Kristi 2023-04-03 21:08:00 UTC
Thank you for submitting a bug report for this, Donna!
Comment 2 Kyle M Hall 2023-04-26 15:26:19 UTC
Created attachment 150247 [details] [review]
Bug 33363: Add separate permissions for creating and deleting suggestions

There are a number of libraries that would like for their staff to be able to submit (and view existing) purchase suggestions from the borrower record, but not give the staff the ability to edit/manage/delete purchase suggestions.

Test Plan:
1) Apply this patch
2) Run restart all the things!
3) Run updatedatabase
4) Verify anyone with the suggestions manage permissions now has the create and delete permissions as well
5) Verify anyone without the suggestions manage permission has not recieved the new permissions
6) Enable only the create permission for a librarian
7) Verify that librarian can only create new suggestions ( not manage or delete )
8) Enable only the manage permission for a librarian
9) Verify that librarian can only manage existing suggestions ( not create or delete )
10) Enable only the delete permission for a librarian
11) Verify that librarian can only delete suggestions ( not create or manage )
Comment 3 PTFS Europe Sandboxes 2023-05-01 10:21:05 UTC
Created attachment 150450 [details] [review]
Bug 33363: Add separate permissions for creating and deleting suggestions

There are a number of libraries that would like for their staff to be able to submit (and view existing) purchase suggestions from the borrower record, but not give the staff the ability to edit/manage/delete purchase suggestions.

Test Plan:
1) Apply this patch
2) Run restart all the things!
3) Run updatedatabase
4) Verify anyone with the suggestions manage permissions now has the create and delete permissions as well
5) Verify anyone without the suggestions manage permission has not recieved the new permissions
6) Enable only the create permission for a librarian
7) Verify that librarian can only create new suggestions ( not manage or delete )
8) Enable only the manage permission for a librarian
9) Verify that librarian can only manage existing suggestions ( not create or delete )
10) Enable only the delete permission for a librarian
11) Verify that librarian can only delete suggestions ( not create or manage )

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Comment 4 Kyle M Hall 2023-07-07 12:56:34 UTC
Created attachment 153177 [details] [review]
Bug 33363: Add separate permissions for creating and deleting suggestions

There are a number of libraries that would like for their staff to be able to submit (and view existing) purchase suggestions from the borrower record, but not give the staff the ability to edit/manage/delete purchase suggestions.

Test Plan:
1) Apply this patch
2) Run restart all the things!
3) Run updatedatabase
4) Verify anyone with the suggestions manage permissions now has the create and delete permissions as well
5) Verify anyone without the suggestions manage permission has not recieved the new permissions
6) Enable only the create permission for a librarian
7) Verify that librarian can only create new suggestions ( not manage or delete )
8) Enable only the manage permission for a librarian
9) Verify that librarian can only manage existing suggestions ( not create or delete )
10) Enable only the delete permission for a librarian
11) Verify that librarian can only delete suggestions ( not create or manage )

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Comment 5 Jonathan Druart 2023-10-04 14:00:27 UTC
Please rebase and add REST API tests.
Comment 6 Kyle M Hall 2024-01-11 13:59:10 UTC
Created attachment 160846 [details] [review]
Bug 33363: Add separate permissions for creating and deleting suggestions

There are a number of libraries that would like for their staff to be able to submit (and view existing) purchase suggestions from the borrower record, but not give the staff the ability to edit/manage/delete purchase suggestions.

Test Plan:
1) Apply this patch
2) Run restart all the things!
3) Run updatedatabase
4) Verify anyone with the suggestions manage permissions now has the create and delete permissions as well
5) Verify anyone without the suggestions manage permission has not recieved the new permissions
6) Enable only the create permission for a librarian
7) Verify that librarian can only create new suggestions ( not manage or delete )
8) Enable only the manage permission for a librarian
9) Verify that librarian can only manage existing suggestions ( not create or delete )
10) Enable only the delete permission for a librarian
11) Verify that librarian can only delete suggestions ( not create or manage )

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Comment 7 Kyle M Hall 2024-01-11 13:59:17 UTC
Created attachment 160847 [details] [review]
Bug 33363: Add unit tests
Comment 8 Martin Renvoize 2024-01-12 09:33:46 UTC
Created attachment 160902 [details] [review]
Bug 33363: Add separate permissions for creating and deleting suggestions

There are a number of libraries that would like for their staff to be able to submit (and view existing) purchase suggestions from the borrower record, but not give the staff the ability to edit/manage/delete purchase suggestions.

Test Plan:
1) Apply this patch
2) Run restart all the things!
3) Run updatedatabase
4) Verify anyone with the suggestions manage permissions now has the create and delete permissions as well
5) Verify anyone without the suggestions manage permission has not recieved the new permissions
6) Enable only the create permission for a librarian
7) Verify that librarian can only create new suggestions ( not manage or delete )
8) Enable only the manage permission for a librarian
9) Verify that librarian can only manage existing suggestions ( not create or delete )
10) Enable only the delete permission for a librarian
11) Verify that librarian can only delete suggestions ( not create or manage )

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2024-01-12 09:33:49 UTC
Created attachment 160903 [details] [review]
Bug 33363: Add unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize 2024-01-12 09:34:27 UTC
Tidied and squash said tidies.

QA scripts now happy, tests make sense and are passing.. controllers updated appropriately.

Passing QA
Comment 11 Katrin Fischer 2024-03-22 09:08:16 UTC
I am sorry, this no longer applies. Can I please get a rebase? It will jump right up back to the front of the list after.

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 33363: Add separate permissions for creating and deleting suggestions
Using index info to reconstruct a base tree...
M	installer/data/mysql/mandatory/userpermissions.sql
M	koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
M	koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
M	koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
M	koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc
M	koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt
M	koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
M	members/purchase-suggestions.pl
M	suggestion/suggestion.pl
M	t/Koha/Auth/Permissions.t
Falling back to patching base and 3-way merge...
Auto-merging t/Koha/Auth/Permissions.t
Auto-merging suggestion/suggestion.pl
CONFLICT (content): Merge conflict in suggestion/suggestion.pl
Auto-merging members/purchase-suggestions.pl
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc
Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
Auto-merging installer/data/mysql/mandatory/userpermissions.sql
error: Failed to merge in the changes.
Patch failed at 0001 Bug 33363: Add separate permissions for creating and deleting suggestions
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-33363-Add-separate-permissions-for-creating-an-4fjafpom.patch
Comment 12 Kyle M Hall 2024-04-18 18:10:42 UTC
Created attachment 165142 [details] [review]
Bug 33363: Add separate permissions for creating and deleting suggestions

There are a number of libraries that would like for their staff to be able to submit (and view existing) purchase suggestions from the borrower record, but not give the staff the ability to edit/manage/delete purchase suggestions.

Test Plan:
1) Apply this patch
2) Run restart all the things!
3) Run updatedatabase
4) Verify anyone with the suggestions manage permissions now has the create and delete permissions as well
5) Verify anyone without the suggestions manage permission has not recieved the new permissions
6) Enable only the create permission for a librarian
7) Verify that librarian can only create new suggestions ( not manage or delete )
8) Enable only the manage permission for a librarian
9) Verify that librarian can only manage existing suggestions ( not create or delete )
10) Enable only the delete permission for a librarian
11) Verify that librarian can only delete suggestions ( not create or manage )

Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Comment 13 Kyle M Hall 2024-04-18 18:10:49 UTC
Created attachment 165143 [details] [review]
Bug 33363: Add unit tests