REPO-557: Retrieve Permissions For Node

-  Added tests and minor changes

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@133082 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Raluca Munteanu
2016-11-24 14:28:13 +00:00
parent 87ec45860b
commit ded07a19fa
2 changed files with 313 additions and 23 deletions

View File

@@ -954,6 +954,7 @@ public class NodesImpl implements Nodes
List<NodePermissions.NodePermission> inheritedPerms = new ArrayList<>(5);
List<NodePermissions.NodePermission> setDirectlyPerms = new ArrayList<>(5);
Set<String> settablePerms = null;
boolean allowRetrievePermission = true;
try
{
@@ -974,10 +975,17 @@ public class NodesImpl implements Nodes
catch (AccessDeniedException ade)
{
// ignore - ie. denied access to retrieve permissions, eg. non-admin on root (Company Home)
allowRetrievePermission = false;
}
NodePermissions nodePerms = new NodePermissions(inherit, inheritedPerms, setDirectlyPerms, settablePerms);
node.setPermissions(nodePerms);
// If the user does not have read permissions at
// least on a special node then do not include permissions and
// returned only node info that he's allowed to see
if (allowRetrievePermission)
{
NodePermissions nodePerms = new NodePermissions(inherit, inheritedPerms, setDirectlyPerms, settablePerms);
node.setPermissions(nodePerms);
}
}
if (includeParam.contains(PARAM_INCLUDE_ASSOCIATION))
@@ -3258,7 +3266,7 @@ public class NodesImpl implements Nodes
boolean duplicate = false;
if (locallySetPermissions != null)
{
HashSet<NodePermissions.NodePermission> temp = new HashSet<NodePermissions.NodePermission>(locallySetPermissions.size());
HashSet<NodePermissions.NodePermission> temp = new HashSet<>(locallySetPermissions.size());
for (NodePermissions.NodePermission permission : locallySetPermissions)
{
temp.add(permission);