X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=server%2Fruntime%2Forg.argeo.server.jcr%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fjcr%2FJcrUtils.java;h=0a2377b61b52ec7ba4d7d7da5856d38beae5f0c8;hb=3ff30fc87c733541ee27246e7cc3fecc52efde0c;hp=fdb82cb85f2bb054e44a39feb95472b2d4b542e9;hpb=69f324f4c2e115192c08f9939d8ecb74e181a34b;p=lgpl%2Fargeo-commons.git diff --git a/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java b/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java index fdb82cb85..0a2377b61 100644 --- a/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java +++ b/server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java @@ -1229,7 +1229,7 @@ public class JcrUtils implements ArgeoJcrConstants { * Convenience method for adding a single privilege to a principal (user or * role), typically jcr:all */ - public static void addPrivilege(Session session, String path, + public synchronized static void addPrivilege(Session session, String path, String principal, String privilege) throws RepositoryException { List privileges = new ArrayList(); privileges.add(session.getAccessControlManager().privilegeFromName( @@ -1252,19 +1252,19 @@ public class JcrUtils implements ArgeoJcrConstants { acl.addAccessControlEntry(principal, privs.toArray(new Privilege[privs.size()])); acm.setPolicy(path, acl); - if (log.isDebugEnabled()) { - StringBuffer privBuf = new StringBuffer(); - for (Privilege priv : privs) - privBuf.append(priv.getName()); - log.debug("Added privileges " + privBuf + " to " + principal - + " on " + path); - } +// if (log.isTraceEnabled()) { +// StringBuffer privBuf = new StringBuffer(); +// for (Privilege priv : privs) +// privBuf.append(priv.getName()); +// log.trace("Added privileges " + privBuf + " to " + principal +// + " on " + path); +// } session.refresh(true); session.save(); } /** Gets access control list for this path, throws exception if not found */ - public static AccessControlList getAccessControlList( + public synchronized static AccessControlList getAccessControlList( AccessControlManager acm, String path) throws RepositoryException { // search for an access control list AccessControlList acl = null; @@ -1291,8 +1291,8 @@ public class JcrUtils implements ArgeoJcrConstants { } /** Clear authorizations for a user at this path */ - public static void clearAccessControList(Session session, String path, - String username) throws RepositoryException { + public synchronized static void clearAccessControList(Session session, + String path, String username) throws RepositoryException { AccessControlManager acm = session.getAccessControlManager(); AccessControlList acl = getAccessControlList(acm, path); for (AccessControlEntry ace : acl.getAccessControlEntries()) {