File tree 3 files changed +43
-4
lines changed
java/org/kitodo/production
webapp/WEB-INF/templates/includes/roleEdit
3 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -956,6 +956,24 @@ public boolean hasAuthorityGlobalToAddOrEditRole() {
956
956
return securityAccessService .hasAuthorityGlobalToAddOrEditRole ();
957
957
}
958
958
959
+ /**
960
+ * Checks if current user has global authority for editing roles.
961
+ *
962
+ * @return true if current user has global authority for editing roles
963
+ */
964
+ public boolean hasAuthorityGlobalToEditRole () {
965
+ return securityAccessService .hasAuthorityGlobalToEditRole ();
966
+ }
967
+
968
+ /**
969
+ * Checks if current user has global authority for viewing a role.
970
+ *
971
+ * @return true if current user has global authority for editing a role
972
+ */
973
+ public boolean hasAuthorityGlobalToViewRole () {
974
+ return securityAccessService .hasAuthorityGlobalToViewRole ();
975
+ }
976
+
959
977
/**
960
978
* Checks if current user has authority to configure displayed columns in list
961
979
* views.
Original file line number Diff line number Diff line change @@ -889,6 +889,25 @@ public boolean hasAuthorityGlobalToAddOrEditRole() {
889
889
return hasAnyAuthorityGlobal ("addRole, editRole" );
890
890
}
891
891
892
+ /**
893
+ * Checks if current user has global authority for editing a role.
894
+ *
895
+ * @return true if current user has global authority for editing a role
896
+ */
897
+ public boolean hasAuthorityGlobalToEditRole () {
898
+ return hasAnyAuthorityGlobal ("editRole" );
899
+ }
900
+
901
+ /**
902
+ * Checks if current user has global authority for viewing a role.
903
+ * Having the authority to edit a role also grants permission to view it inherently.
904
+ *
905
+ * @return true if current user has global authority for editing a role
906
+ */
907
+ public boolean hasAuthorityGlobalToViewRole () {
908
+ return hasAnyAuthorityGlobal ("viewRole, editRole" );
909
+ }
910
+
892
911
/**
893
912
* Check if current user has global authority to view role list. It returns true
894
913
* if user has "viewAllRoles" authority globally.
Original file line number Diff line number Diff line change 42
42
</ p:row >
43
43
< p:row rendered ="#{not SecurityAccessController.hasAuthorityGlobalToAddOrEditRole()} " />
44
44
</ p:panelGrid >
45
- < p:panelGrid columns ="2 " layout ="grid ">
46
- < p:row >
45
+ < p:panelGrid columns ="#{SecurityAccessController.hasAuthorityGlobalToViewRole() ? 2 : 1} "
46
+ layout ="grid ">
47
+ < p:row rendered ="#{SecurityAccessController.hasAuthorityGlobalToViewRole()} ">
47
48
<!--global authorities-->
48
49
< h:panelGroup >
49
50
< h3 style ="margin-bottom: 20px ">
50
51
< h:outputText value ="#{msgs.globalAssignable} "/>
51
52
</ h3 >
53
+ <!--@elvariable id="authority" type="org.kitodo.data.database.beans.Authority"-->
52
54
< p:pickList id ="authoritiesGlobalPick "
53
55
showSourceFilter ="true " showTargetFilter ="true "
54
56
filterMatchMode ="contains "
55
57
responsive ="true "
56
- disabled ="#{isViewMode} "
58
+ disabled ="#{not SecurityAccessController.hasAuthorityGlobalToEditRole() or isViewMode} "
57
59
value ="#{RoleForm.globalAssignableAuthorities} "
58
60
converter ="#{authorityConverter} "
59
61
var ="authority "
70
72
<!--client authorities-->
71
73
< h:panelGroup >
72
74
< h3 style ="margin-bottom: 20px ">
73
- < h:outputText value ="#{msgs.clientAssignable} "/>
75
+ < h:outputText value ="#{SecurityAccessController.hasAuthorityGlobalToViewRole() ? msgs.clientAssignable : msgs.authorities } "/>
74
76
</ h3 >
75
77
< p:pickList id ="authoritiesClientPick "
76
78
value ="#{RoleForm.clientAssignableAuthorities} "
You can’t perform that action at this time.
0 commit comments