Skip to content

Commit

Permalink
CMTF, VTA Branch Admin (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
slominskir authored Sep 10, 2024
1 parent 92d7621 commit 5945225
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions container/keycloak/initdb.d/04_accounts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 |"
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions container/oracle/initdb.d/03_default_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/WEB-INF/tags/page.tag
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
href="${pageContext.request.contextPath}/links">Links</a></li>
<li${fn:startsWith(currentPath, '/reports') ? ' class="current-primary"' : ''}><a
href="${pageContext.request.contextPath}/reports/overall-status">Reports</a></li>
<c:if test="${pageContext.request.isUserInRole('srm-admin') || pageContext.request.isUserInRole('halead') || pageContext.request.isUserInRole('hblead') || pageContext.request.isUserInRole('hclead') || pageContext.request.isUserInRole('hdlead') || pageContext.request.isUserInRole('lerfadm') || pageContext.request.isUserInRole('cryoadm')}">
<c:if test="${pageContext.request.isUserInRole('srm-admin') || pageContext.request.isUserInRole('halead') || pageContext.request.isUserInRole('hblead') || pageContext.request.isUserInRole('hclead') || pageContext.request.isUserInRole('hdlead') || pageContext.request.isUserInRole('lerfadm') || pageContext.request.isUserInRole('cryoadm') || pageContext.request.isUserInRole('cmtfadm') || pageContext.request.isUserInRole('vtaadm')}">
<li${fn:startsWith(currentPath, '/setup') ? ' class="current-primary"' : ''}><a
href="${pageContext.request.contextPath}/setup/category-tree">Setup</a></li>
</c:if>
Expand Down
8 changes: 8 additions & 0 deletions src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
<role-name>hdlead</role-name>
<role-name>lerfadm</role-name>
<role-name>cryoadm</role-name>
<role-name>vtaadm</role-name>
<role-name>cmtfadm</role-name>
</auth-constraint>
</security-constraint>
<login-config>
Expand All @@ -106,6 +108,12 @@
<security-role>
<role-name>cryoadm</role-name>
</security-role>
<security-role>
<role-name>vtaadm</role-name>
</security-role>
<security-role>
<role-name>cmtfadm</role-name>
</security-role>
<security-role>
<role-name>cc</role-name>
</security-role>
Expand Down

0 comments on commit 5945225

Please sign in to comment.