Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue_tracker] Modify ['action','description'] in the permissions fo… #9577

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions SQL/0000-00-02-Permission.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,24 @@ CREATE TABLE `permissions` (
`description` varchar(255) NOT NULL DEFAULT '',
`moduleID` int(11) unsigned,
`action` enum (
'View',
'Close',
'Create',
'Edit',
'Create/Edit',
'Delete',
'Download',
'Edit',
'Edit/Upload',
'Edit/Upload/Delete',
'Edit/Upload/Hide',
'Upload',
'Delete',
'View',
'View/Create',
'View/Edit',
'View/Download',
'View/Upload',
'View/Create/Edit',
'Create/Edit',
'Edit/Upload',
'Edit/Upload/Delete',
'Edit/Upload/Hide'),
'View/Download',
'View/Edit',
'View/Edit/Comment',
'View/Edit/Comment/Close',
'View/Upload'),
`categoryID` int(10) NOT NULL DEFAULT '2',
PRIMARY KEY (`permID`),
UNIQUE KEY `code` (`code`),
Expand Down Expand Up @@ -105,8 +108,8 @@ INSERT INTO `permissions` VALUES
(33,'genomic_data_manager','Genomic Files',(SELECT ID FROM modules WHERE Name='genomic_browser'),'Upload','2'),
(34,'media_write','Candidate Media Files',(SELECT ID FROM modules WHERE Name='media'),'Edit/Upload/Hide','2'),
(35,'media_read','Candidate Media Files',(SELECT ID FROM modules WHERE Name='media'),'View/Download','2'),
(36,'issue_tracker_own_issue', 'See/Edit/Comment and Close on Own Issues',(SELECT ID FROM modules WHERE Name='issue_tracker'),NULL, 2),
(37,'issue_tracker_all_issue', 'See/Edit/Comment on all Issues',(SELECT ID FROM modules WHERE Name='issue_tracker'),NULL, 2),
(36,'issue_tracker_own_issue', 'Issues - Own',(SELECT ID FROM modules WHERE Name='issue_tracker'),'View/Edit/Comment/Close', 2),
(37,'issue_tracker_all_issue', 'Issues - All Sites',(SELECT ID FROM modules WHERE Name='issue_tracker'),'View/Edit/Comment', 2),
(38,'imaging_browser_phantom_allsites', 'Phantom Scans - All Sites',(SELECT ID FROM modules WHERE Name='imaging_browser'),'View', 2),
(39,'imaging_browser_phantom_ownsite', 'Phantom Scans - Own Sites',(SELECT ID FROM modules WHERE Name='imaging_browser'),'View', 2),
(40,'data_release_view', 'Release Files',(SELECT ID FROM modules WHERE Name='data_release'),'View', 2),
Expand Down Expand Up @@ -137,9 +140,9 @@ INSERT INTO `permissions` VALUES
(65,'schedule_module','Schedule Module - edit and delete the appointment',(SELECT ID FROM modules WHERE Name='schedule_module'),'View/Create/Edit','2'),
(66,'document_repository_categories','Categories',(SELECT ID FROM modules WHERE Name='document_repository'), 'Edit/Upload/Delete', '2'),
(67,'document_repository_hidden','Restricted files',(SELECT ID FROM modules WHERE Name='document_repository'), 'View', '2'),
(68,'issue_tracker_site_issue','See/Edit/Comment on Own Site Issues',(SELECT ID FROM modules WHERE Name = 'issue_tracker'),NULL,2),
(69,'issue_tracker_close_site_issue','Close Own Site Issues',(SELECT ID FROM modules WHERE Name = 'issue_tracker'),NULL,2),
(70,'issue_tracker_close_all_issue','Close all Issues',(SELECT ID FROM modules WHERE Name = 'issue_tracker'),NULL,2);
(68,'issue_tracker_site_issue','Issues - Own Sites',(SELECT ID FROM modules WHERE Name = 'issue_tracker'),'View/Edit/Comment',2),
(69,'issue_tracker_close_site_issue','Issues - Own Sites',(SELECT ID FROM modules WHERE Name = 'issue_tracker'),'Close',2),
(70,'issue_tracker_close_all_issue','Issues - All Sites',(SELECT ID FROM modules WHERE Name = 'issue_tracker'),'Close',2);


INSERT INTO `user_perm_rel` (userID, permID)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
UPDATE permissions SET code = 'issue_tracker_own_issue', description = 'See/Edit/Comment and Close on Own Issues'
ALTER TABLE permissions CHANGE `action` `action` enum (
'Close',
'Create',
'Create/Edit',
'Delete',
'Download',
'Edit',
'Edit/Upload',
'Edit/Upload/Delete',
'Edit/Upload/Hide',
'Upload',
'View',
'View/Create',
'View/Create/Edit',
'View/Download',
'View/Edit',
'View/Edit/Comment',
'View/Edit/Comment/Close',
'View/Upload'
);

UPDATE permissions SET code = 'issue_tracker_own_issue', description = 'Issues - Own', action = 'View/Edit/Comment/Close'
WHERE code = 'issue_tracker_reporter';
UPDATE permissions SET code = 'issue_tracker_all_issue', description = 'See/Edit/Comment on all Issues'
UPDATE permissions SET code = 'issue_tracker_all_issue', description = 'Issues - All Sites', action = 'View/Edit/Comment'
WHERE code = 'issue_tracker_developer';

INSERT INTO permissions (code, description, moduleID, categoryID) VALUES
('issue_tracker_site_issue','See/Edit/Comment on Own Site Issues',(SELECT ID FROM modules WHERE Name = 'issue_tracker'),2),
('issue_tracker_close_site_issue','Close Own Site Issues',(SELECT ID FROM modules WHERE Name = 'issue_tracker'),2),
('issue_tracker_close_all_issue','Close all Issues',(SELECT ID FROM modules WHERE Name = 'issue_tracker'),2);
INSERT INTO permissions (code, description, moduleID, action, categoryID) VALUES
('issue_tracker_site_issue','Issues - Own Sites',(SELECT ID FROM modules WHERE Name = 'issue_tracker'),'View/Edit/Comment',2),
('issue_tracker_close_site_issue','Issues - Own Sites',(SELECT ID FROM modules WHERE Name = 'issue_tracker'),'Close',2),
('issue_tracker_close_all_issue','Issues - All Sites',(SELECT ID FROM modules WHERE Name = 'issue_tracker'),'Close',2);
4 changes: 2 additions & 2 deletions modules/issue_tracker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
The Issues Module allows users to track issues they have with data, or with their LORIS instance itself. A form with pre-defined fields is provided for users to submit issues, upload attachments and a filter-form gives a sortable and filterable table view of issues viewable by the user.

## Permissions
- `issue_tracker_own_issue` permission allows seeing, editing, adding an issue, closing and commenting on issues created by the user.
- `issue_tracker_site_issue` permission allows to do the same except closing an issue, as well as editing any field of a submitted issue for the user site(s).
- `issue_tracker_own_issue` permission allows viewing, editing, adding an issue, closing and commenting on issues created by the user.
- `issue_tracker_site_issue` permission allows to do the same except closing an issue, as well as editing any field of a submitted issue from the user site(s).
- `issue_tracker_all_issue` permission allows to do the same except closing an issue, as well as editing any field of a submitted issue for all site.
- `issue_tracker_close_site_issue` permission allows closing issue created by the user site(s)
- `issue_tracker_close_all_issue` permission allows closing issue for all sites
Expand Down
60 changes: 32 additions & 28 deletions modules/issue_tracker/test/issue_tracker_test_plan.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,56 @@
# Issue Tracker Test Plan

## Issue Tracker Filter Form [Automation Testing]
1. User can access the page only if they have `Issue Tracker: Close/Edit/Re-assign/Comment on All Issues` or ` Issue Tracker: Create/Edit Own Issues and Comment on All Issues` permission
2. User can see data from other sites only if they have `access_all_profiles` permission
3. Test that all filters work. Nothing should be filtered at first loading.
4. Test that all preset filters work and redirect to the correct table.
5. Test that the watching checkbox works correctly (issues that your userID is watching in issues_watching table)
6. Check that links to issues in table are correct.
7. Check that table sorts and displays additional pages correctly
8. Check that a user who does not have `access_all_profiles` permission and belongs to only one site can see all issues with a NULL centerID. Check that they have the label `All Sites` in the Site column.
1. User can access the page only if they have `Issue Tracker: View/Edit/Comment Issues - All Sites` or `Issue Tracker: View/Edit/Comment Issues - Own Sites` or `Issue Tracker: View/Edit/Comment/Close Issues - Own` permission.
2. User can see data from all sites if they have `Issue Tracker: View/Edit/Comment Issues - All Sites` permission.
3. User can see data only from their site(s) if they have `Issue Tracker: View/Edit/Comment Issues - Own Sites` permission.
4. User can see only their data if they have `Issue Tracker: View/Edit/Comment/Close Issues - Own` permission.
5. Check that user do not have access if only they have `Issue Tracker: Close Issues - All Sites` or `Issue Tracker: Close Issues - Own Sites` permission.
6. Check that a user cannot close an issue if they do not have `Issue Tracker: Close Issues - All Sites` or `Issue Tracker: Close Issues - Own Sites` or `Issue Tracker: View/Edit/Comment/Close Issues - Own` permission.
7. Test that all filters work. Nothing should be filtered at first loading.
8. Test that all preset filters work and redirect to the correct table.
9. Test that the watching checkbox works correctly (issues that your userID is watching in issues_watching table)
10. Check that links to issues in table are correct.
11. Check that table sorts and displays additional pages correctly
12. Check that a user who has `Issue Tracker: View/Edit/Comment Issues - Own Sites` permission and belongs to only one site can see all issues with a NULL centerID. Check that they have the label `All Sites` in the Site column.

## Issue Tracker Create New Issue [Manual Testing]
1. User can access the page if they have `Issue Tracker: Close/Edit/Re-assign/Comment on All Issues` or `Issue Tracker: Create/Edit Own Issues and Comment on All Issues` permission.
1. User can access the page if they have `Issue Tracker: View/Edit/Comment Issues - All Sites` or `Issue Tracker: View/Edit/Comment Issues - Own Sites` or `Issue Tracker: View/Edit/Comment/Close Issues - Own` permission.
2. Check that title and site are required.
3. Do not provide a PSCID value and set site to All Sites. This should set `issues.centerID` to `NULL` after success.
4. Do not provide a PSCID value and and check that site can be populated by a particular site (except All Sites) in the dropdown values.
5. Submit a PSCID and set Site to All Sites. This should work if the PSCID exists in the database.
6. Submit a PSCID with a Site value (except All Sites). This should not work if the PSCID does not exists or if the PSCID does not match with the site.
7. Should display message, and redirect after success.
8. Submit invalid and valid PSCID and visit label pairs. Error messages should display accordingly.
9. A user should be able to submit a PSCID from other sites only if they have `access_all_profiles` permission.
9. A user should be able to submit a PSCID from other sites only if they have `Issue Tracker: View/Edit/Comment Issues - All Sites` permission.
10. Submit just a visit label - this should give an error message.
11. Check that all values are propagated and saved correctly.
12. Add an attachment to the new issue and make sure that it is successfully uploaded.
13. Check that watching options are working - turn it off and on for your current user, and for other watchers on the issue, and check that values are saved.

## Issue Tracker Edit Existing Issue [Manual Testing]
1. User can access the page if they fulfill all the following conditions:
* they have `Issue Tracker: Close/Edit/Re-assign/Comment on All Issues` or ` Issue Tracker: Create/Edit Own Issues and Comment on All Issues` permission
* they have `access_all_profiles` or are a member of the site of the issue or the site has no issue.
2. Users who have `Issue Tracker: Create/Edit Own Issues and Comment on All Issues` permission can edit all fields if it is their issue, but are blocked except for commenting and watching options for all other issues. Users with `Issue Tracker: Close/Edit/Re-assign/Comment on All Issues` permission can make all changes on all issues that they can view.
3. Users can only enter a PSCID for those candidate that are in their site.
4. Submit invalid and valid PSCID and visit label pairs. Error messages should respond accordingly. Not that you cannot submit PSCIDs from other sites unless you have `access_all_profiles` permission
5. Submit just a visit label - this should give an error message.
6. Check that all values are propagated and saved correctly.
7. Check that watching options are working - turn it off and on for your current user, and for other watchers on the issue, and check that values are saved.
8. Add an attachment to the new issue and make sure that it is successfully uploaded.
9. Check that an attachment can be added to an existing issue.
10. Test if users assigned to issues can upload attachments.
11. Test if users can delete their own uploaded attachments.
12. Test if user assigned to issue cannot delete attachments of issue owner.
13. Test that emails are sent to users that are watching the issue.
* they have `Issue Tracker: View/Edit/Comment Issues - All Sites` or `Issue Tracker: View/Edit/Comment Issues - Own Sites` or `Issue Tracker: View/Edit/Comment/Close Issues - Own` permission.
2. Users can only enter a PSCID for those candidate that are in their site.
3. Submit invalid and valid PSCID and visit label pairs. Error messages should respond accordingly. Not that you cannot submit PSCIDs from other sites unless you have `Issue Tracker: View/Edit/Comment Issues - All Sites` permission.
4. Submit just a visit label - this should give an error message.
5. Check that all values are propagated and saved correctly.
6. Check that watching options are working - turn it off and on for your current user, and for other watchers on the issue, and check that values are saved.
7. Add an attachment to the new issue and make sure that it is successfully uploaded.
8. Check that an attachment can be added to an existing issue.
9. Test if users assigned to issues can upload attachments.
10. Test if users can delete their own uploaded attachments.
11. Test if user assigned to issue cannot delete attachments of issue owner.
12. Test that emails are sent to users that are watching the issue.

## Permissions [Automation Testing]
1. Remove `access_all_profiles` permission.
2. Remove `Issue Tracker: Create/Edit Own Issues and Comment on All Issues` permission
3. Remove `Issue Tracker: Close/Edit/Re-assign/Comment on All Issues` permission
4. Test that the module behaves correctly as described above.
1. Remove `Issue Tracker: View/Edit/Comment Issues - All Sites` permission.
2. Remove `Issue Tracker: View/Edit/Comment Issues - Own Sites` permission.
3. Remove `Issue Tracker: View/Edit/Comment/Close Issues - Own` permission.
4. Remove `Issue Tracker: Close Issues - All Sites` permission.
5. Remove `Issue Tracker: Close Issues - Own Sites` permission.
6. Test that the module behaves correctly as described above.

**Test the Issue Tracker Dashboard widget**
1. The dashboard widget named My Tasks, should display the correct number of assigned issues.
Expand Down
10 changes: 5 additions & 5 deletions raisinbread/RB_files/RB_permissions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (42,'genomic_data_manager','Genomic Files',18,'Upload',2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (43,'media_write','Candidate Media Files',29,'Edit/Upload/Delete',2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (44,'media_read','Candidate Media Files',29,'View/Download',2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (45,'issue_tracker_own_issue','See/Edit/Comment and Close on Own Issues',27,NULL,2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (46,'issue_tracker_all_issue','See/Edit/Comment on all Issues',27,NULL,2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (45,'issue_tracker_own_issue','Issues - Own',27,'View/Edit/Comment/Close',2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (46,'issue_tracker_all_issue','Issues - All Sites',27,'View/Edit/Comment',2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (47,'imaging_browser_phantom_allsites','Phantom Scans - All Sites',20,'View',2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (48,'imaging_browser_phantom_ownsite','Phantom Scans - Own Sites',20,'View',2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (49,'instrument_manager_read','Installed Instruments',25,'View',2);
Expand Down Expand Up @@ -68,9 +68,9 @@ INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (74,'document_repository_categories','Categories',16,'Edit/Upload/Delete',2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (75,'document_repository_hidden','Restricted files',16,'View',2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (76,'media_upload_digest','Media files: Access to recently uploaded media notifications digest.',29,'Edit',2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (77,'issue_tracker_site_issue','See/Edit/Comment on Own Site Issues',27,NULL,2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (78,'issue_tracker_close_site_issue','Close Own Site Issues',27,NULL,2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (79,'issue_tracker_close_all_issue','Close all Issues',27,NULL,2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (77,'issue_tracker_site_issue','Issues - Own Sites',27,'View/Edit/Comment',2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (78,'issue_tracker_close_site_issue','Issues - Own Sites',27,'Close',2);
INSERT INTO `permissions` (`permID`, `code`, `description`, `moduleID`, `action`, `categoryID`) VALUES (79,'issue_tracker_close_all_issue','Issues - All Sites',27,'Close',2);


UNLOCK TABLES;
Expand Down
Loading