Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[bugfix] Do not cache Remote Resource permissions when calling UserMa…

…nagementService#getPermissions(Resource) as they may have changed, at which point the client will see out of date permissions.
  • Loading branch information...
commit 0dcdfee9b293e05a452e35f5ac470a9f58e39cce 1 parent 16bc41b
@adamretter adamretter authored
Showing with 19 additions and 24 deletions.
  1. +19 −24 src/org/exist/xmldb/RemoteUserManagementService.java
View
43 src/org/exist/xmldb/RemoteUserManagementService.java
@@ -614,35 +614,30 @@ public Permission getPermissions(Resource res) throws XMLDBException {
throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, "resource is null");
}
- Permission perm = ((EXistResource)res).getPermissions();
+ //TODO : use dedicated function in XmldbURI
+ final String path = ((RemoteCollection) res.getParentCollection()).getPath() + "/" + res.getId();
+ try {
+ final List<Object> params = new ArrayList<Object>(1);
+ params.add(path);
- if(perm == null) {
- //TODO : use dedicated function in XmldbURI
- final String path = ((RemoteCollection) res.getParentCollection()).getPath() + "/" + res.getId();
- try {
- final List<Object> params = new ArrayList<Object>(1);
- params.add(path);
+ final HashMap<?,?> result = (HashMap<?,?>) parent.getClient().execute("getPermissions", params);
- final HashMap<?,?> result = (HashMap<?,?>) parent.getClient().execute("getPermissions", params);
+ final String owner = (String)result.get("owner");
+ final String group = (String)result.get("group");
+ final int mode = ((Integer)result.get("permissions")).intValue();
+ final Object[] acl = (Object[])result.get("acl");
+ List aces = null;
+ if(acl != null) {
+ aces = Arrays.asList(acl);
+ }
- final String owner = (String)result.get("owner");
- final String group = (String)result.get("group");
- final int mode = ((Integer)result.get("permissions")).intValue();
- final Object[] acl = (Object[])result.get("acl");
- List aces = null;
- if (acl != null)
- {aces = Arrays.asList(acl);}
+ return getPermission(owner, group, mode, (List<ACEAider>)aces);
- perm = getPermission(owner, group, mode, (List<ACEAider>)aces);
-
- } catch (final XmlRpcException e) {
- throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e);
- } catch(final PermissionDeniedException pde) {
- throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, pde.getMessage(), pde);
- }
+ } catch (final XmlRpcException e) {
+ throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage(), e);
+ } catch(final PermissionDeniedException pde) {
+ throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, pde.getMessage(), pde);
}
-
- return perm;
}
@Override
Please sign in to comment.
Something went wrong with that request. Please try again.