mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Show permissions in Node Browser.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2280 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -40,6 +40,9 @@ import org.alfresco.service.cmr.repository.Path;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.cmr.security.AccessPermission;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
@@ -83,12 +86,15 @@ public class AdminNodeBrowseBean
|
||||
private DataModel properties = null;
|
||||
private DataModel children = null;
|
||||
private DataModel assocs = null;
|
||||
private Boolean inheritPermissions = null;
|
||||
private DataModel permissions = null;
|
||||
|
||||
// supporting repository services
|
||||
private NodeService nodeService;
|
||||
private DictionaryService dictionaryService;
|
||||
private SearchService searchService;
|
||||
private NamespaceService namespaceService;
|
||||
private PermissionService permissionService;
|
||||
|
||||
/**
|
||||
* @param nodeService node service
|
||||
@@ -122,6 +128,14 @@ public class AdminNodeBrowseBean
|
||||
this.namespaceService = namespaceService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param permissionService permission service
|
||||
*/
|
||||
public void setPermissionService(PermissionService permissionService)
|
||||
{
|
||||
this.permissionService = permissionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of repository stores
|
||||
*
|
||||
@@ -168,6 +182,8 @@ public class AdminNodeBrowseBean
|
||||
properties = null;
|
||||
children = null;
|
||||
assocs = null;
|
||||
inheritPermissions = null;
|
||||
permissions = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,6 +276,45 @@ public class AdminNodeBrowseBean
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the current node inherits its permissions from a parent node
|
||||
*
|
||||
* @return true => inherits permissions
|
||||
*/
|
||||
public boolean getInheritPermissions()
|
||||
{
|
||||
if (inheritPermissions == null)
|
||||
{
|
||||
inheritPermissions = permissionService.getInheritParentPermissions(nodeRef);
|
||||
}
|
||||
return inheritPermissions.booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current node permissions
|
||||
*
|
||||
* @return the permissions
|
||||
*/
|
||||
public DataModel getPermissions()
|
||||
{
|
||||
if (permissions == null)
|
||||
{
|
||||
AccessStatus readPermissions = permissionService.hasPermission(nodeRef, PermissionService.READ_PERMISSIONS);
|
||||
if (readPermissions.equals(AccessStatus.ALLOWED))
|
||||
{
|
||||
List<AccessPermission> nodePermissions = new ArrayList<AccessPermission>(permissionService.getAllSetPermissions(nodeRef));
|
||||
permissions = new ListDataModel(nodePermissions);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<NoReadPermissionGranted> noReadPermissions = new ArrayList<NoReadPermissionGranted>(1);
|
||||
noReadPermissions.add(new NoReadPermissionGranted());
|
||||
permissions = new ListDataModel(noReadPermissions);
|
||||
}
|
||||
}
|
||||
return permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current node children
|
||||
@@ -710,6 +765,27 @@ public class AdminNodeBrowseBean
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Permission representing the fact that "Read Permissions" has not been granted
|
||||
*/
|
||||
public class NoReadPermissionGranted
|
||||
{
|
||||
public String getPermission()
|
||||
{
|
||||
return PermissionService.READ_PERMISSIONS;
|
||||
}
|
||||
|
||||
public String getAuthority()
|
||||
{
|
||||
return "[Current Authority]";
|
||||
}
|
||||
|
||||
public String getAccessStatus()
|
||||
{
|
||||
return "Not Granted";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper class for Search Results
|
||||
*/
|
||||
|
@@ -961,6 +961,10 @@
|
||||
<property-name>namespaceService</property-name>
|
||||
<value>#{NamespaceService}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>permissionService</property-name>
|
||||
<value>#{PermissionService}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<!-- Forums managed beans -->
|
||||
|
@@ -94,7 +94,7 @@
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<h:outputText styleClass="mainTitle" value="Propertes"/>
|
||||
<h:outputText styleClass="mainTitle" value="Properties"/>
|
||||
|
||||
<h:dataTable id="properties" border="1" value="#{AdminNodeBrowseBean.properties}" var="property">
|
||||
<h:column>
|
||||
@@ -154,6 +154,37 @@
|
||||
</h:column>
|
||||
</h:dataTable>
|
||||
|
||||
<br>
|
||||
<h:outputText styleClass="mainTitle" value="Permissions"/>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><b>Inherit:</b></td><td><h:outputText id="inheritPermissions" value="#{AdminNodeBrowseBean.inheritPermissions}"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<h:dataTable id="permissions" border="1" value="#{AdminNodeBrowseBean.permissions}" var="permission">
|
||||
<h:column>
|
||||
<f:facet name="header">
|
||||
<h:outputText value="Assigned Permission"/>
|
||||
</f:facet>
|
||||
<h:outputText value="#{permission.permission}"/>
|
||||
</h:column>
|
||||
<h:column>
|
||||
<f:facet name="header">
|
||||
<h:outputText value="To Authority"/>
|
||||
</f:facet>
|
||||
<h:outputText value="#{permission.authority}"/>
|
||||
</h:column>
|
||||
<h:column>
|
||||
<f:facet name="header">
|
||||
<h:outputText value="Access"/>
|
||||
</f:facet>
|
||||
<h:outputText value="#{permission.accessStatus}"/>
|
||||
</h:column>
|
||||
</h:dataTable>
|
||||
|
||||
<br>
|
||||
<h:outputText styleClass="mainTitle" value="Children"/>
|
||||
|
||||
|
Reference in New Issue
Block a user