diff --git a/src/main/java/edu/harvard/iq/dataverse/ManagePermissionsPage.java b/src/main/java/edu/harvard/iq/dataverse/ManagePermissionsPage.java index 83d48574bf9..e992036e350 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ManagePermissionsPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/ManagePermissionsPage.java @@ -2,6 +2,7 @@ import edu.harvard.iq.dataverse.authorization.AuthenticationServiceBean; import edu.harvard.iq.dataverse.authorization.DataverseRole; +import edu.harvard.iq.dataverse.authorization.DataverseRolePermissionHelper; import edu.harvard.iq.dataverse.authorization.Permission; import edu.harvard.iq.dataverse.authorization.RoleAssignee; import edu.harvard.iq.dataverse.authorization.RoleAssigneeDisplayInfo; @@ -77,6 +78,9 @@ public class ManagePermissionsPage implements java.io.Serializable { @Inject DataverseSession session; + + private DataverseRolePermissionHelper dataverseRolePermissionHelper; + private List roleList; DvObject dvObject = new Dataverse(); // by default we use a Dataverse, but this will be overridden in init by the findById @@ -112,6 +116,8 @@ public String init() { if (dvObject instanceof Dataverse) { initAccessSettings(); } + roleList = roleService.findAll(); + dataverseRolePermissionHelper = new DataverseRolePermissionHelper(roleList); return ""; } @@ -379,6 +385,40 @@ public DataverseRole getAssignedRole() { } return null; } + + public String getAssignedRoleObjectTypes(){ + String retString = ""; + if (selectedRoleId != null) { + if (dataverseRolePermissionHelper.hasDataversePermissions(selectedRoleId)){ + retString = "Dataverses"; + } + if (dataverseRolePermissionHelper.hasDatasetPermissions(selectedRoleId)){ + if(!retString.isEmpty()) { + retString +=", Datasets"; + } else { + retString = "Datasets"; + } + + } + if (dataverseRolePermissionHelper.hasFilePermissions(selectedRoleId)){ + if(!retString.isEmpty()) { + retString +=", Data Files"; + } else { + retString = "Data Files"; + } + } + return retString; + } + return null; + } + + public String getDefinitionLevelString(){ + if (dvObject != null){ + if (dvObject instanceof Dataverse) return "Dataverse"; + if (dvObject instanceof Dataset) return "Dataset"; + } + return null; + } public void assignRole(ActionEvent evt) { logger.info("Got to assignRole"); @@ -487,6 +527,15 @@ public void updateRole(ActionEvent e) { } showRoleMessages(); } + + + public DataverseRolePermissionHelper getDataverseRolePermissionHelper() { + return dataverseRolePermissionHelper; + } + + public void setDataverseRolePermissionHelper(DataverseRolePermissionHelper dataverseRolePermissionHelper) { + this.dataverseRolePermissionHelper = dataverseRolePermissionHelper; + } /* ============================================================================ diff --git a/src/main/webapp/roles-assign.xhtml b/src/main/webapp/roles-assign.xhtml index dcffe84cda1..c9d934bb602 100644 --- a/src/main/webapp/roles-assign.xhtml +++ b/src/main/webapp/roles-assign.xhtml @@ -74,8 +74,8 @@ - - + +