generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ORV2-1887 Configure HQADMIN and FINANCE user groups in onRouteBC (
#1112) Co-authored-by: John Fletcher <[email protected]> Co-authored-by: Krishnan Subramanian <[email protected]>
- Loading branch information
1 parent
7d2a67a
commit d95fed6
Showing
17 changed files
with
213 additions
and
28 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
database/mssql/scripts/versions/revert/v_13_ddl_revert.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
SET ANSI_NULLS ON | ||
GO | ||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
SET NOCOUNT ON | ||
GO | ||
|
||
DELETE FROM [access].[ORBC_GROUP_ROLE] WHERE USER_AUTH_GROUP_TYPE IN ('HQADMIN', 'FINANCE') | ||
GO | ||
UPDATE [dbo].[ORBC_IDIR_USER] | ||
SET USER_AUTH_GROUP_TYPE = 'IDIRBASIC' | ||
WHERE USER_AUTH_GROUP_TYPE IN ('HQADMIN', 'FINANCE') | ||
GO | ||
UPDATE [dbo].[ORBC_PENDING_IDIR_USER] | ||
SET USER_AUTH_GROUP_TYPE = 'IDIRBASIC' | ||
WHERE USER_AUTH_GROUP_TYPE IN ('HQADMIN', 'FINANCE') | ||
GO | ||
DELETE FROM [access].[ORBC_ROLE_TYPE] WHERE ROLE_TYPE IN ( | ||
'ORBC-READ-SPECIAL-AUTH', | ||
'ORBC-READ-NOFEE', | ||
'ORBC-WRITE-NOFEE', | ||
'ORBC-READ-LCV-FLAG', | ||
'ORBC-WRITE-LCV-FLAG', | ||
'ORBC-READ-LOA', | ||
'ORBC-WRITE-LOA' | ||
) | ||
GO | ||
DELETE FROM [access].[ORBC_USER_AUTH_GROUP_TYPE] WHERE USER_AUTH_GROUP_TYPE IN ('HQADMIN', 'FINANCE') | ||
GO | ||
|
||
DECLARE @VersionDescription VARCHAR(255) | ||
SET @VersionDescription = 'Removing auth groups HQADMIN and FINANCE' | ||
|
||
INSERT [dbo].[ORBC_SYS_VERSION] ([VERSION_ID], [DESCRIPTION], [RELEASE_DATE]) VALUES (12, @VersionDescription, getutcdate()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
SET ANSI_NULLS ON | ||
GO | ||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
SET NOCOUNT ON | ||
GO | ||
|
||
-- Add new auth groups | ||
INSERT [access].[ORBC_USER_AUTH_GROUP_TYPE] ([USER_AUTH_GROUP_TYPE], [DISPLAY_NAME], [DESCRIPTION], [STAFF_FLAG], [CONCURRENCY_CONTROL_NUMBER], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (N'HQADMIN', N'MOTI HQ Administrator', N'MOTI HQ administrator not part of the permit centre', 1, NULL, N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE()) | ||
INSERT [access].[ORBC_USER_AUTH_GROUP_TYPE] ([USER_AUTH_GROUP_TYPE], [DISPLAY_NAME], [DESCRIPTION], [STAFF_FLAG], [CONCURRENCY_CONTROL_NUMBER], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (N'FINANCE', N'Finance Staff', N'Finance team at the permit centre', 1, NULL, N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE()) | ||
GO | ||
|
||
-- Add new auth roles | ||
INSERT [access].[ORBC_ROLE_TYPE] ([ROLE_TYPE], [ROLE_DESCRIPTION]) VALUES (N'ORBC-READ-SPECIAL-AUTH', NULL) | ||
INSERT [access].[ORBC_ROLE_TYPE] ([ROLE_TYPE], [ROLE_DESCRIPTION]) VALUES (N'ORBC-READ-NOFEE', NULL) | ||
INSERT [access].[ORBC_ROLE_TYPE] ([ROLE_TYPE], [ROLE_DESCRIPTION]) VALUES (N'ORBC-WRITE-NOFEE', NULL) | ||
INSERT [access].[ORBC_ROLE_TYPE] ([ROLE_TYPE], [ROLE_DESCRIPTION]) VALUES (N'ORBC-READ-LCV-FLAG', NULL) | ||
INSERT [access].[ORBC_ROLE_TYPE] ([ROLE_TYPE], [ROLE_DESCRIPTION]) VALUES (N'ORBC-WRITE-LCV-FLAG', NULL) | ||
INSERT [access].[ORBC_ROLE_TYPE] ([ROLE_TYPE], [ROLE_DESCRIPTION]) VALUES (N'ORBC-READ-LOA', NULL) | ||
INSERT [access].[ORBC_ROLE_TYPE] ([ROLE_TYPE], [ROLE_DESCRIPTION]) VALUES (N'ORBC-WRITE-LOA', NULL) | ||
GO | ||
|
||
-- Assign auth roles to new auth groups | ||
-- HQADMIN roles | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-READ-SELF') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-READ-ORG') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-READ-SPECIAL-AUTH') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-READ-NOFEE') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-WRITE-NOFEE') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-READ-LCV-FLAG') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-WRITE-LCV-FLAG') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-READ-LOA') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-WRITE-LOA') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-GENERATE-REPORT') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-GENERATE-TRANSACTION-REPORT') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-GENERATE-TRANSACTION-REPORT-ALL') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-READ-BILLING') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-STAFF') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'HQADMIN', N'ORBC-READ-USER') | ||
-- FINANCE roles | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-READ-SELF') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-READ-ORG') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-READ-SPECIAL-AUTH') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-READ-NOFEE') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-WRITE-NOFEE') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-READ-PERMIT') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-GENERATE-REPORT') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-GENERATE-TRANSACTION-REPORT') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-GENERATE-TRANSACTION-REPORT-ALL') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-READ-BILLING') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-READ-PAYMENT') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-STAFF') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-READ-USER') | ||
INSERT [access].[ORBC_GROUP_ROLE] ([USER_AUTH_GROUP_TYPE], [ROLE_TYPE]) VALUES (N'FINANCE', N'ORBC-READ-DOCUMENT') | ||
GO | ||
|
||
DECLARE @VersionDescription VARCHAR(255) | ||
SET @VersionDescription = 'Include auth groups HQADMIN and FINANCE' | ||
|
||
INSERT [dbo].[ORBC_SYS_VERSION] ([VERSION_ID], [DESCRIPTION], [UPDATE_SCRIPT], [REVERT_SCRIPT], [RELEASE_DATE]) VALUES (13, @VersionDescription, '$(UPDATE_SCRIPT)', '$(REVERT_SCRIPT)', getutcdate()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
SET ANSI_NULLS ON | ||
GO | ||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
SET NOCOUNT ON | ||
GO | ||
DELETE FROM $(DB_NAME).tps.ORBC_TPS_MIGRATED_PERMITS | ||
DELETE FROM $(DB_NAME).permit.ORBC_PERMIT_DATA | ||
DELETE FROM $(DB_NAME).permit.ORBC_PERMIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Test that the auth groups have been inserted correctly | ||
SET NOCOUNT ON | ||
|
||
SELECT COUNT(*) FROM $(DB_NAME).[access].[ORBC_USER_AUTH_GROUP_TYPE] | ||
WHERE USER_AUTH_GROUP_TYPE IN ('HQADMIN', 'FINANCE') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- Test that the auth roles have been inserted correctly | ||
SET NOCOUNT ON | ||
|
||
SELECT COUNT(*) FROM $(DB_NAME).[access].[ORBC_ROLE_TYPE] | ||
WHERE ROLE_TYPE IN ( | ||
'ORBC-READ-SPECIAL-AUTH', | ||
'ORBC-READ-NOFEE', | ||
'ORBC-WRITE-NOFEE', | ||
'ORBC-READ-LCV-FLAG', | ||
'ORBC-WRITE-LCV-FLAG', | ||
'ORBC-READ-LOA', | ||
'ORBC-WRITE-LOA' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- Test that the auth groups have been inserted correctly | ||
SET NOCOUNT ON | ||
|
||
SELECT COUNT(*) FROM $(DB_NAME).[access].[ORBC_GROUP_ROLE] | ||
WHERE USER_AUTH_GROUP_TYPE IN ('HQADMIN', 'FINANCE') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# Retrieve arguments | ||
source ${SCRIPT_DIR}/utility/getopt.sh | ||
USAGE="-u USER -p PASS -s SERVER -d DATABASE" | ||
parse_options "${USAGE}" ${@} | ||
|
||
# All database tests for database version 13 are run from this shell script. | ||
# TESTS_DIR variable set by the calling test-runner script. | ||
|
||
TEST_13_1_RESULT=$(/opt/mssql-tools/bin/sqlcmd -U ${USER} -P "${PASS}" -S ${SERVER} -v DB_NAME=${DATABASE} -h -1 -i ${TESTS_DIR}/v_13_1_test.sql | xargs) | ||
if [[ $TEST_13_1_RESULT -eq 2 ]]; then | ||
echo "Test 13.1 passed: User auth groups inserted correctly" | ||
else | ||
echo "******** Test 13.1 failed: User auth groups not inserted correctly" | ||
fi | ||
|
||
TEST_13_2_RESULT=$(/opt/mssql-tools/bin/sqlcmd -U ${USER} -P "${PASS}" -S ${SERVER} -v DB_NAME=${DATABASE} -h -1 -i ${TESTS_DIR}/v_13_2_test.sql | xargs) | ||
if [[ $TEST_13_2_RESULT -eq 7 ]]; then | ||
echo "Test 13.2 passed: User auth roles inserted correctly" | ||
else | ||
echo "******** Test 13.2 failed: User auth roles not inserted correctly" | ||
fi | ||
|
||
TEST_13_3_RESULT=$(/opt/mssql-tools/bin/sqlcmd -U ${USER} -P "${PASS}" -S ${SERVER} -v DB_NAME=${DATABASE} -h -1 -i ${TESTS_DIR}/v_13_3_test.sql | xargs) | ||
if [[ $TEST_13_3_RESULT -eq 25 ]]; then | ||
echo "Test 13.3 passed: Correct number of role mappings inserted" | ||
else | ||
echo "******** Test 13.3 failed: Incorrect number of role mappings inserted" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters