Skip to content

Commit

Permalink
psp-6906 management claims (#3485)
Browse files Browse the repository at this point in the history
Co-authored-by: Alejandro Sanchez <[email protected]>
  • Loading branch information
devinleighsmith and asanchezr authored Sep 20, 2023
1 parent b6de9cc commit f280519
Show file tree
Hide file tree
Showing 19 changed files with 807 additions and 3 deletions.
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

0 comments on commit f280519

Please sign in to comment.