RM-3074: Review comments

This commit is contained in:
Roy Wetherall
2016-08-17 10:53:40 +10:00
parent 2d1fd2f133
commit 03f26a0bd2
2 changed files with 22 additions and 16 deletions

View File

@@ -177,20 +177,16 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
@Override
public Set<String> getReaders(NodeRef nodeRef)
{
Set<String> result = null;
ParameterCheck.mandatory("nodeRef", nodeRef);
Set<String> result = Collections.EMPTY_SET;
Pair<String, String> iprGroups = getIPRGroups(nodeRef);
if (iprGroups != null)
{
result = new HashSet<String>(authorityService.getContainedAuthorities(null, iprGroups.getFirst(), true));
result.remove(iprGroups.getSecond());
}
else
{
result = Collections.EMPTY_SET;
result = getAuthorities(iprGroups.getFirst());
}
return result;
return result;
}
/**
@@ -200,20 +196,29 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
@Override
public Set<String> getWriters(NodeRef nodeRef)
{
Set<String> result = null;
ParameterCheck.mandatory("nodeRef", nodeRef);
Set<String> result = Collections.EMPTY_SET;
Pair<String, String> iprGroups = getIPRGroups(nodeRef);
if (iprGroups != null)
{
result = authorityService.getContainedAuthorities(null, iprGroups.getSecond(), true);
}
else
{
result = Collections.EMPTY_SET;
result = getAuthorities(iprGroups.getSecond());
}
return result;
}
/**
* Helper to get authorities for a given group
*
* @param group group name
* @return Set<String> immediate authorities
*/
private Set<String> getAuthorities(String group)
{
Set<String> result = new HashSet<String>();
result.addAll(authorityService.getContainedAuthorities(null, group, true));
return result;
}
/**
@@ -222,6 +227,8 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl
@Override
public void set(NodeRef nodeRef, Pair<Set<String>, Set<String>> readersAndWriters)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
set(nodeRef, readersAndWriters.getFirst(), readersAndWriters.getSecond());
}

View File

@@ -147,7 +147,6 @@ public class ExtendedPermissionServiceImpl extends PermissionServiceImpl impleme
AccessStatus result = AccessStatus.UNDETERMINED;
if (nodeService.exists(nodeRef))
{
// permission pre-processors
List<PermissionPreProcessor> preProcessors = permissionProcessorRegistry.getPermissionPreProcessors();
for (PermissionPreProcessor preProcessor : preProcessors)