Merged 5.2.0 (5.2.0) to HEAD (5.2)

133082 rmunteanu: REPO-557: Retrieve Permissions For Node
      -  Added tests and minor changes


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@133389 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-12-06 17:17:47 +00:00
parent 9416d65751
commit 4a6cc66b2b
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);