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

SELV3-785: Add rights for managing dashboard reports and report categories #135

Merged
merged 3 commits into from
Jan 8, 2025
Merged
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ serviceName=openlmis-referencedata
# Only a Release Manager should update this
# See https://openlmis.atlassian.net/wiki/display/OP/Rolling+a+Release
######################################################################
serviceVersion=15.3.0-SNAPSHOT
serviceVersion=15.2.9-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
WITH existing_right AS (
SELECT id, name
FROM referencedata.rights
WHERE name IN ('REPORTS_MANAGE', 'REPORT_CATEGORIES_MANAGE')
),
inserted_right AS (
INSERT INTO referencedata.rights (id, description, name, type)
SELECT CAST('88f87966-9c78-4cc5-a34a-fdd01b3bc42d' AS UUID), NULL, 'REPORTS_MANAGE', 'GENERAL_ADMIN'
WHERE NOT EXISTS (SELECT 1 FROM existing_right WHERE name = 'REPORTS_MANAGE')
UNION ALL
SELECT CAST('353f6664-439e-4e08-93ac-ba853d8f22a8' AS UUID), NULL, 'REPORT_CATEGORIES_MANAGE', 'GENERAL_ADMIN'
WHERE NOT EXISTS (SELECT 1 FROM existing_right WHERE name = 'REPORT_CATEGORIES_MANAGE')
RETURNING id, name
),
all_rights AS (
SELECT * FROM existing_right
UNION ALL
SELECT * FROM inserted_right
)
INSERT INTO referencedata.role_rights (roleid, rightid)
SELECT CAST('a439c5de-b8aa-11e6-80f5-76304dec7eb7' AS UUID), id
FROM all_rights
WHERE NOT EXISTS (
SELECT 1
FROM referencedata.role_rights
WHERE roleid = CAST('a439c5de-b8aa-11e6-80f5-76304dec7eb7' AS UUID)
AND rightid = all_rights.id
);
Loading