04-30-2008 04:54 AM
04-30-2008 06:38 AM
permissionService.getAllSetPermissions(nodeRef);.
// check if current authenticated user can read the permissions on the current node
AccessStatus readPermissions = permissionService.hasPermission(nodeRef, PermissionService.READ_PERMISSIONS);
if (readPermissions.equals(AccessStatus.ALLOWED))
{
// get all the permissions set on the node
Set<AccessPermission> permissions = permissionService.getAllSetPermissions(nodeRef);
// loop through the permissions and filter for users and groups with access
for (AccessPermission permission : permissions)
{
if (permission.getAccessStatus().equals(AccessStatus.ALLOWED) &&
(permission.getAuthorityType().equals(AuthorityType.USER) ||
permission.getAuthorityType().equals(AuthorityType.GROUP)))
{
// check if the authority is a group or user
String authority = permission.getAuthority();
AuthorityType authType = AuthorityType.getAuthorityType(authority);
// If user check they exist and do something
if (authType.equals(AuthorityType.USER))
{
if(this.personService.personExists(authority))
{
// do something here
}
}
// If group get all members and check if they exist
if (authType.equals(AuthorityType.GROUP))
{
Set<String> users = this.authorityService.getContainedAuthorities(AuthorityType.USER, authority, false);
for (String userAuth : users)
{
if (this.personService.personExists(userAuth) == true)
{
// do something here
}
}
}
}
}
}
04-30-2008 07:22 AM
05-21-2008 04:20 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.