projects
/
lgpl
/
argeo-commons.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
565466f
)
Security in Jcr singleton.
author
Mathieu Baudier <mbaudier@argeo.org>
Sun, 27 Oct 2019 09:02:19 +0000
(10:02 +0100)
committer
Mathieu Baudier <mbaudier@argeo.org>
Sun, 27 Oct 2019 09:02:19 +0000
(10:02 +0100)
org.argeo.jcr/src/org/argeo/jcr/Jcr.java
patch
|
blob
|
history
diff --git
a/org.argeo.jcr/src/org/argeo/jcr/Jcr.java
b/org.argeo.jcr/src/org/argeo/jcr/Jcr.java
index 608f897365f112df382cf05d94a8887840d78980..43e47dacad11512df281923caca5ae37e5bea9dc 100644
(file)
--- a/
org.argeo.jcr/src/org/argeo/jcr/Jcr.java
+++ b/
org.argeo.jcr/src/org/argeo/jcr/Jcr.java
@@
-14,6
+14,7
@@
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;
+import javax.jcr.security.Privilege;
import javax.jcr.version.Version;
import javax.jcr.version.VersionHistory;
import javax.jcr.version.VersionIterator;
import javax.jcr.version.Version;
import javax.jcr.version.VersionHistory;
import javax.jcr.version.VersionIterator;
@@
-337,6
+338,23
@@
public class Jcr {
}
}
}
}
+ /*
+ * SECURITY
+ */
+ /**
+ * Add a single privilege to a node.
+ *
+ * @see Privilege
+ */
+ public static void addPrivilege(Node node, String principal, String privilege) {
+ try {
+ Session session = node.getSession();
+ JcrUtils.addPrivilege(session, node.getPath(), principal, privilege);
+ } catch (RepositoryException e) {
+ throw new IllegalStateException("Cannot add privilege " + privilege + " to " + node, e);
+ }
+ }
+
/*
* VERSIONING
*/
/*
* VERSIONING
*/