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

psp-6906 management claims #3485

Merged
merged 2 commits into from
Sep 20, 2023
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
14 changes: 13 additions & 1 deletion source/backend/dal/Security/Permissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,22 @@ public enum Permissions
[Display(GroupName = "compensationRequisition", Name = "compensation-requisition-add", Description = "Ability to add new Acquisition File compensation requisitions.")]
CompensationRequisitionAdd = 55,

[Display(GroupName = "compensationRequisition", Name = "compensation-requisition-edit", Description = "Ability to edit existing fAcquisition File compensation requisitions.")]
[Display(GroupName = "compensationRequisition", Name = "compensation-requisition-edit", Description = "Ability to edit existing Acquisition File compensation requisitions.")]
CompensationRequisitionEdit = 56,

[Display(GroupName = "compensationRequisition", Name = "compensation-requisition-delete", Description = "Ability to delete Acquisition File compensation requisitions.")]
CompensationRequisitionDelete = 57,

[Display(GroupName = "management", Name = "management-view", Description = "Ability to view Management information.")]
ManagementView = 58,

[Display(GroupName = "management", Name = "management-add", Description = "Ability to add new Management information.")]
ManagementAdd = 59,

[Display(GroupName = "management", Name = "management-edit", Description = "Ability to edit existing Management information.")]
ManagementEdit = 60,

[Display(GroupName = "management", Name = "management-delete", Description = "Ability to delete Management information.")]
ManagementDelete = 61,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
DECLARE @managementView BIGINT;
DECLARE @managementAdd BIGINT;
DECLARE @managementEdit BIGINT;
DECLARE @managementDelete BIGINT;
SELECT @managementView = CLAIM_ID FROM PIMS_CLAIM WHERE NAME = 'management-view';
SELECT @managementAdd = CLAIM_ID FROM PIMS_CLAIM WHERE NAME = 'management-add';
SELECT @managementEdit = CLAIM_ID FROM PIMS_CLAIM WHERE NAME = 'management-edit';
SELECT @managementDelete = CLAIM_ID FROM PIMS_CLAIM WHERE NAME = 'management-delete';

DECLARE @managementFunctional BIGINT;
DECLARE @managementReadOnly BIGINT;
SELECT @managementFunctional = ROLE_ID FROM PIMS_ROLE WHERE NAME = 'Management functional';
SELECT @managementReadOnly = ROLE_ID FROM PIMS_ROLE WHERE NAME = 'Management read-only';

DELETE FROM [dbo].[PIMS_ROLE_CLAIM] WHERE CLAIM_ID = @managementView;
DELETE FROM [dbo].[PIMS_ROLE_CLAIM] WHERE CLAIM_ID = @managementEdit;
DELETE FROM [dbo].[PIMS_ROLE_CLAIM] WHERE CLAIM_ID = @managementAdd;
DELETE FROM [dbo].[PIMS_ROLE_CLAIM] WHERE CLAIM_ID = @managementDelete;

DELETE FROM [dbo].[PIMS_ROLE_CLAIM] WHERE ROLE_ID = @managementFunctional;
DELETE FROM [dbo].[PIMS_ROLE_CLAIM] WHERE ROLE_ID = @managementReadOnly;

GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
DECLARE @managementView BIGINT;
DECLARE @managementAdd BIGINT;
DECLARE @managementEdit BIGINT;
DECLARE @managementDelete BIGINT;
SELECT @managementView = CLAIM_ID FROM PIMS_CLAIM WHERE NAME = 'management-view';
SELECT @managementAdd = CLAIM_ID FROM PIMS_CLAIM WHERE NAME = 'management-add';
SELECT @managementEdit = CLAIM_ID FROM PIMS_CLAIM WHERE NAME = 'management-edit';
SELECT @managementDelete = CLAIM_ID FROM PIMS_CLAIM WHERE NAME = 'management-delete';


DELETE FROM [dbo].[PIMS_CLAIM] WHERE CLAIM_ID = @managementView;
DELETE FROM [dbo].[PIMS_CLAIM] WHERE CLAIM_ID = @managementEdit;
DELETE FROM [dbo].[PIMS_CLAIM] WHERE CLAIM_ID = @managementAdd;
DELETE FROM [dbo].[PIMS_CLAIM] WHERE CLAIM_ID = @managementDelete;

GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
DECLARE @managementFunctional BIGINT;
DECLARE @managementReadOnly BIGINT;
SELECT @managementFunctional = ROLE_ID FROM PIMS_ROLE WHERE NAME = 'Management functional';
SELECT @managementReadOnly = ROLE_ID FROM PIMS_ROLE WHERE NAME = 'Management read-only';


DELETE FROM [dbo].[PIMS_ROLE] WHERE ROLE_ID = @managementFunctional;
DELETE FROM [dbo].[PIMS_ROLE] WHERE ROLE_ID = @managementReadOnly;

GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
INSERT INTO PIMS_ROLE (ROLE_UID, NAME, DESCRIPTION, IS_PUBLIC, IS_DISABLED, SORT_ORDER, APP_CREATE_TIMESTAMP, APP_CREATE_USERID, APP_CREATE_USER_DIRECTORY, APP_LAST_UPDATE_TIMESTAMP, APP_LAST_UPDATE_USERID, APP_LAST_UPDATE_USER_DIRECTORY)
VALUES
(NEWID(), N'Management functional', N'Access to create, read, update Management information.', CONVERT([bit],(1)), CONVERT([bit],(0)), 0, CURRENT_TIMESTAMP, N'Seed Data', N'Seed Data', CURRENT_TIMESTAMP, N'Seed Data', N'Seed Data'),
(NEWID(), N'Management read-only', N'Access to read Management information.', CONVERT([bit],(1)), CONVERT([bit],(0)), 0, CURRENT_TIMESTAMP, N'Seed Data', N'Seed Data', CURRENT_TIMESTAMP, N'Seed Data', N'Seed Data');
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
BEGIN TRANSACTION;

DECLARE @dbUserId nvarchar(30) = 'system';
DECLARE @dbUserGuid uniqueidentifier = null;
DECLARE @appUserId nvarchar(30) = N'SEED';
DECLARE @appUserGuid uniqueidentifier = '1b93f614-91da-4b32-b36e-bd2c6ebd12e2';
DECLARE @appUserDirectory nvarchar(30) = N'';
DECLARE @seedTime DateTime = GETDATE();

INSERT [dbo].[PIMS_CLAIM]
([CLAIM_ID], [CLAIM_UID], [NAME], [KEYCLOAK_ROLE_ID], [DESCRIPTION], [IS_DISABLED], [CONCURRENCY_CONTROL_NUMBER], [APP_CREATE_TIMESTAMP], [APP_CREATE_USERID], [APP_CREATE_USER_GUID], [APP_CREATE_USER_DIRECTORY], [DB_CREATE_TIMESTAMP], [DB_CREATE_USERID], [APP_LAST_UPDATE_TIMESTAMP], [APP_LAST_UPDATE_USERID], [APP_LAST_UPDATE_USER_GUID], [APP_LAST_UPDATE_USER_DIRECTORY], [DB_LAST_UPDATE_TIMESTAMP], [DB_LAST_UPDATE_USERID])
VALUES
(57, N'bd03cd23-00c0-4ba0-88af-9f75c788d132', N'management-view', N'bd03cd23-00c0-4ba0-88af-9f75c788d132', N'Ability to view Property Management information.', 0, 1, @seedTime, @appUserId, @appUserGuid, @appUserDirectory, @seedTime, @dbUserId, @seedTime, @appUserId, @appUserGuid, @appUserDirectory, @seedTime, @dbUserId);

INSERT [dbo].[PIMS_CLAIM]
([CLAIM_ID], [CLAIM_UID], [NAME], [KEYCLOAK_ROLE_ID], [DESCRIPTION], [IS_DISABLED], [CONCURRENCY_CONTROL_NUMBER], [APP_CREATE_TIMESTAMP], [APP_CREATE_USERID], [APP_CREATE_USER_GUID], [APP_CREATE_USER_DIRECTORY], [DB_CREATE_TIMESTAMP], [DB_CREATE_USERID], [APP_LAST_UPDATE_TIMESTAMP], [APP_LAST_UPDATE_USERID], [APP_LAST_UPDATE_USER_GUID], [APP_LAST_UPDATE_USER_DIRECTORY], [DB_LAST_UPDATE_TIMESTAMP], [DB_LAST_UPDATE_USERID])
VALUES
(58, N'b52f72ee-f67c-46e4-8977-d835876bd99e', N'management-add', N'b52f72ee-f67c-46e4-8977-d835876bd99e', N'Ability to add new Property Management information.', 0, 1, @seedTime, @appUserId, @appUserGuid, @appUserDirectory, @seedTime, @dbUserId, @seedTime, @appUserId, @appUserGuid, @appUserDirectory, @seedTime, @dbUserId);

INSERT [dbo].[PIMS_CLAIM]
([CLAIM_ID], [CLAIM_UID], [NAME], [KEYCLOAK_ROLE_ID], [DESCRIPTION], [IS_DISABLED], [CONCURRENCY_CONTROL_NUMBER], [APP_CREATE_TIMESTAMP], [APP_CREATE_USERID], [APP_CREATE_USER_GUID], [APP_CREATE_USER_DIRECTORY], [DB_CREATE_TIMESTAMP], [DB_CREATE_USERID], [APP_LAST_UPDATE_TIMESTAMP], [APP_LAST_UPDATE_USERID], [APP_LAST_UPDATE_USER_GUID], [APP_LAST_UPDATE_USER_DIRECTORY], [DB_LAST_UPDATE_TIMESTAMP], [DB_LAST_UPDATE_USERID])
VALUES
(59, N'f2245e95-6972-4cdb-9893-ae9e14442d2c', N'management-edit', N'f2245e95-6972-4cdb-9893-ae9e14442d2c', N'Ability to edit existing Property Management information.', 0, 1, @seedTime, @appUserId, @appUserGuid, @appUserDirectory, @seedTime, @dbUserId, @seedTime, @appUserId, @appUserGuid, @appUserDirectory, @seedTime, @dbUserId);

INSERT [dbo].[PIMS_CLAIM]
([CLAIM_ID], [CLAIM_UID], [NAME], [KEYCLOAK_ROLE_ID], [DESCRIPTION], [IS_DISABLED], [CONCURRENCY_CONTROL_NUMBER], [APP_CREATE_TIMESTAMP], [APP_CREATE_USERID], [APP_CREATE_USER_GUID], [APP_CREATE_USER_DIRECTORY], [DB_CREATE_TIMESTAMP], [DB_CREATE_USERID], [APP_LAST_UPDATE_TIMESTAMP], [APP_LAST_UPDATE_USERID], [APP_LAST_UPDATE_USER_GUID], [APP_LAST_UPDATE_USER_DIRECTORY], [DB_LAST_UPDATE_TIMESTAMP], [DB_LAST_UPDATE_USERID])
VALUES
(60, N'3b4c435c-e74f-47e4-a229-74e89f7efaec', N'management-delete', N'3b4c435c-e74f-47e4-a229-74e89f7efaec', N'Ability to delete Property Management information.', 0, 1, @seedTime, @appUserId, @appUserGuid, @appUserDirectory, @seedTime, @dbUserId, @seedTime, @appUserId, @appUserGuid, @appUserDirectory, @seedTime, @dbUserId);

COMMIT TRANSACTION;
Loading