From 594522502b559e596e000469209e699f56b60b37 Mon Sep 17 00:00:00 2001 From: Ryan Slominski Date: Tue, 10 Sep 2024 17:22:35 -0400 Subject: [PATCH] CMTF, VTA Branch Admin (#13) --- container/keycloak/initdb.d/04_accounts.sh | 4 ++++ container/oracle/initdb.d/03_default_data.sql | 1 + .../org/jlab/srm/business/session/AbstractFacade.java | 6 ++++++ src/main/webapp/WEB-INF/tags/page.tag | 2 +- src/main/webapp/WEB-INF/web.xml | 8 ++++++++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/container/keycloak/initdb.d/04_accounts.sh b/container/keycloak/initdb.d/04_accounts.sh index 1271617..50a490b 100755 --- a/container/keycloak/initdb.d/04_accounts.sh +++ b/container/keycloak/initdb.d/04_accounts.sh @@ -16,6 +16,8 @@ KEYCLOAK_ROLE_NAME=group2Leaders create_role KEYCLOAK_ROLE_NAME=group3Leaders create_role +KEYCLOAK_ROLE_NAME=vtaadm +create_role echo "----------------" echo "| Create Users |" @@ -75,4 +77,6 @@ create_user KEYCLOAK_ROLE_NAME=${KEYCLOAK_RESOURCE}-user assign_role KEYCLOAK_ROLE_NAME=group3Leaders +assign_role +KEYCLOAK_ROLE_NAME=vtaadm assign_role \ No newline at end of file diff --git a/container/oracle/initdb.d/03_default_data.sql b/container/oracle/initdb.d/03_default_data.sql index 6110813..8d396be 100644 --- a/container/oracle/initdb.d/03_default_data.sql +++ b/container/oracle/initdb.d/03_default_data.sql @@ -287,6 +287,7 @@ insert into SRM_OWNER.CATEGORY (CATEGORY_ID, NAME, PARENT_ID, WEIGHT) values (66 insert into SRM_OWNER.CATEGORY (CATEGORY_ID, NAME, PARENT_ID, WEIGHT) values (665, 'UITF Laser', 663, 1000); insert into SRM_OWNER.CATEGORY (CATEGORY_ID, NAME, PARENT_ID, WEIGHT) values (703, 'UITF Beamline Vacuum', 656, 1000); insert into SRM_OWNER.CATEGORY (CATEGORY_ID, NAME, PARENT_ID, WEIGHT) values (743, 'HDR', 242, 1000); +insert into SRM_OWNER.CATEGORY (CATEGORY_ID, NAME, PARENT_ID, WEIGHT) values (900, 'VTA', 0, 16); DROP SEQUENCE SRM_OWNER.CATEGORY_ID; CREATE SEQUENCE SRM_OWNER.CATEGORY_ID diff --git a/src/main/java/org/jlab/srm/business/session/AbstractFacade.java b/src/main/java/org/jlab/srm/business/session/AbstractFacade.java index 2c13f33..e731eb2 100644 --- a/src/main/java/org/jlab/srm/business/session/AbstractFacade.java +++ b/src/main/java/org/jlab/srm/business/session/AbstractFacade.java @@ -239,6 +239,12 @@ protected boolean isAdminOrBranchAdmin(String username, Category branchRoot) { case "Cryo": isBranchAdmin = context.isCallerInRole("cryoadm"); break; + case "CMTF": + isBranchAdmin = context.isCallerInRole("cmtfadm"); + break; + case "VTA": + isBranchAdmin = context.isCallerInRole("vtaadm"); + break; } } if (isBranchAdmin) { diff --git a/src/main/webapp/WEB-INF/tags/page.tag b/src/main/webapp/WEB-INF/tags/page.tag index 6d87ff3..9794c84 100644 --- a/src/main/webapp/WEB-INF/tags/page.tag +++ b/src/main/webapp/WEB-INF/tags/page.tag @@ -45,7 +45,7 @@ href="${pageContext.request.contextPath}/links">Links Reports - + Setup diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index d778ca0..f69887b 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -80,6 +80,8 @@ hdlead lerfadm cryoadm + vtaadm + cmtfadm @@ -106,6 +108,12 @@ cryoadm + + vtaadm + + + cmtfadm + cc