Author: tripod
Date: Thu Oct 3 13:23:51 2013
New Revision: 1528848
URL: http://svn.apache.org/r1528848
Log:
@trivial javadoc
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBits.java
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBits.java
URL:
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBits.java?rev=1528848&r1=1528847&r2=1528848&view=diff
==============================================================================
---
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBits.java
(original)
+++
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBits.java
Thu Oct 3 13:23:51 2013
@@ -230,6 +230,7 @@ public final class PrivilegeBits impleme
if ((privs & MODIFY_PROPERTIES) == MODIFY_PROPERTIES) {
perm |= Permissions.SET_PROPERTY;
} else {
+ // todo: what about add+alter (but not remove?)
if ((privs & ADD_PROPERTIES) == ADD_PROPERTIES) {
perm |= Permissions.ADD_PROPERTY;
} else if ((privs & ALTER_PROPERTIES) == ALTER_PROPERTIES) {
@@ -507,10 +508,37 @@ public final class PrivilegeBits impleme
abstract boolean includes(long permissions);
+ /**
+ * Checks if all {@code otherBits} is already included in {@code bits}.
+ * <p>
+ * Truth table:
+ * <pre>
+ * | b\o | 0 | 1 |
+ * | 0 | 1 | 0 |
+ * | 1 | 1 | 1 |
+ * </pre>
+ * @param bits the super set of bits
+ * @param otherBits the bits to check against
+ * @return <code>true</code> if all other bits are included in bits.
+ */
static boolean includes(long bits, long otherBits) {
+ // todo: different check as 'and' check below. which one is
faster?
return (bits | ~otherBits) == -1;
}
+ /**
+ * Checks if all {@code otherBits} is already included in {@code bits}.
+ * <p>
+ * Truth table:
+ * <pre>
+ * | b\o | 0 | 1 |
+ * | 0 | 1 | 0 |
+ * | 1 | 1 | 1 |
+ * </pre>
+ * @param bits the super set of bits
+ * @param otherBits the bits to check against
+ * @return <code>true</code> if all other bits are included in bits.
+ */
static boolean includes(long[] bits, long[] otherBits) {
if (otherBits.length <= bits.length) {
// test for each long if is included