/** * Creates a mutable instance of privilege bits. * * @return a new instance of privilege bits. */ public static PrivilegeBits getInstance() { return new PrivilegeBits(new ModifiableData()); }
/** * Subtract the other Data from this instance. * * @param other */ private void diff(Data other) { if (bits.length == 1 && other.isSimple()) { bits[0] = bits[0] & ~other.longValue(); } else { bits = diff(bits, other.longValues()); } }
@Override boolean includes(Data other) { if (isSimple) { return (other.isSimple()) && includes(bits, other.longValue()); } else { return includes(bitsArr, other.longValues()); } }
private static PrivilegeBits toBits(Set<String> supported, PrivilegeBitsProvider pbp) { PrivilegeBits suppBits = PrivilegeBits.getInstance(); for (String s : supported) { suppBits.add(pbp.getBits(s)); } return suppBits; }
@Override boolean includes(Data other) { if (bits.length == 1) { return other.isSimple() && includes(bits[0], other.longValue()); } else { return includes(bits, other.longValues()); } }
PrivilegeValidator(Root before, Root after) { rootBefore = before; rootAfter = after; bitsProvider = new PrivilegeBitsProvider(rootBefore); }
@Override public String toString() { return definition.getName(); } }
/** * Returns {@code true} if this privilege bits includes no privileges * at all. * * @return {@code true} if this privilege bits includes no privileges * at all; {@code false} otherwise. * @see org.apache.jackrabbit.oak.spi.security.authorization.permission.Permissions#NO_PERMISSION */ public boolean isEmpty() { return d.isEmpty(); }
/** * Subtract the other Data from this instance. * * @param other */ private void diff(Data other) { if (bits.length == 1 && other.isSimple()) { bits[0] = bits[0] & ~other.longValue(); } else { bits = diff(bits, other.longValues()); } }
@Override boolean includes(Data other) { if (isSimple) { return (other.isSimple()) && includes(bits, other.longValue()); } else { return includes(bitsArr, other.longValues()); } }
@Override boolean includes(Data other) { if (bits.length == 1) { return other.isSimple() && includes(bits[0], other.longValue()); } else { return includes(bits, other.longValues()); } }
@Override public String toString() { return definition.getName(); } }
/** * Creates a mutable instance of privilege bits. * * @return a new instance of privilege bits. */ public static PrivilegeBits getInstance() { return new PrivilegeBits(new ModifiableData()); }
/** * Returns {@code true} if this privilege bits includes no privileges * at all. * * @return {@code true} if this privilege bits includes no privileges * at all; {@code false} otherwise. * @see org.apache.jackrabbit.oak.spi.security.authorization.permission.Permissions#NO_PERMISSION */ public boolean isEmpty() { return d.isEmpty(); }
/** * Add the other Data to this instance. * * @param other */ private void add(Data other) { if (other != this) { if (bits.length == 1 && other.isSimple()) { bits[0] |= other.longValue(); } else { or(other.longValues()); } } }
@Override public String toString() { return definition.getName(); } }
/** * Add the diff between the specified Data a and b. * * @param a * @param b */ private void addDifference(Data a, Data b) { if (a.isSimple() && b.isSimple()) { bits[0] |= a.longValue() & ~b.longValue(); } else { long[] diff = diff(a.longValues(), b.longValues()); or(diff); } }
@Override public String getName() { return def.getName(); }
/** * Add the diff between the specified Data a and b. * * @param a * @param b */ private void addDifference(Data a, Data b) { if (a.isSimple() && b.isSimple()) { bits[0] |= a.longValue() & ~b.longValue(); } else { long[] diff = diff(a.longValues(), b.longValues()); or(diff); } }
/** * Add the other Data to this instance. * * @param other */ private void add(Data other) { if (other != this) { if (bits.length == 1 && other.isSimple()) { bits[0] |= other.longValue(); } else { or(other.longValues()); } } }