Ok, can you please find the file: resources\db\migration\postgresql\V2.7.2.20190528153600__fix-ir-report-perms.sql
Replace the contents of that file with the below:
CREATE TEMP TABLE temp_migration (
from_perm_id int,
new_value character varying(255)
);
INSERT INTO temp_migration (from_perm_id, new_value)
SELECT sp.id as from_id,
REPLACE(CAST(new_perms.val AS VARCHAR(255)), '%s', REPLACE(REPLACE(value, 'source:', ''), ':access', '')) as new_value
FROM ${ohdsiSchema}.sec_permission sp
CROSS JOIN (
SELECT 'ir:%s:info:*:delete' val
) new_perms
WHERE sp.value LIKE 'source:%:access';
INSERT INTO ${ohdsiSchema}.sec_permission (id, value)
SELECT nextval('${ohdsiSchema}.sec_permission_id_seq'), new_value
FROM temp_migration;
INSERT INTO ${ohdsiSchema}.sec_role_permission (id,role_id, permission_id)
SELECT nextval('${ohdsiSchema}.sec_role_permission_sequence'),
srp.role_id,
sp.id as permission_id
FROM temp_migration m
JOIN ${ohdsiSchema}.sec_permission sp on m.new_value = sp.value
JOIN ${ohdsiSchema}.sec_role_permission srp on m.from_perm_id = srp.permission_id;
drop table temp_migration;
What this does is: finds the data sources that have been granted access permission, and stores the permission_id for each of those sources. Then inserts a new permission for deleting IR results. Then, it needs to assign roles to this new permission, based on the permission that has access to the data source. This last part is what broke the old implementation: with multiple roles having this permission, the logic of the original query led to duplicate permissions.
I can push this change up to a branch if you prefer to build off of a branch instead of making a change to the file. I’m not sure if you are building off of a master branch or if you are using a release tag…