@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof Entry) { Entry other = (Entry) o; return Objects.equal(principalName, other.principalName) && privilegeBits.equals(other.privilegeBits) && restrictions.equals(other.restrictions); } return false; } }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof Entry) { Entry other = (Entry) o; return Objects.equal(principalName, other.principalName) && privilegeBits.equals(other.privilegeBits) && restrictions.equals(other.restrictions); } return false; } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof PermissionEntry) { PermissionEntry that = (PermissionEntry) o; return index == that.index && isAllow == that.isAllow && privilegeBits.equals(that.privilegeBits) && path.equals(that.path) && restriction.equals(that.restriction); } return false; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof PermissionEntry) { PermissionEntry that = (PermissionEntry) o; return index == that.index && isAllow == that.isAllow && privilegeBits.equals(that.privilegeBits) && path.equals(that.path) && restriction.equals(that.restriction); } return false; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof PermissionEntry) { PermissionEntry that = (PermissionEntry) o; return index == that.index && isAllow == that.isAllow && privilegeBits.equals(that.privilegeBits) && path.equals(that.path) && restriction.equals(that.restriction); } return false; }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof Entry) { Entry other = (Entry) o; return Objects.equal(principalName, other.principalName) && privilegeBits.equals(other.privilegeBits) && restrictions.equals(other.restrictions); } return false; } }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof AcEntry) { AcEntry other = (AcEntry) o; return isAllow == other.isAllow && privilegeBits.equals(other.privilegeBits) && principalName.equals(other.principalName) && accessControlledPath.equals(other.accessControlledPath) && restrictions.equals(other.restrictions); } return false; }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof AcEntry) { AcEntry other = (AcEntry) o; return isAllow == other.isAllow && privilegeBits.equals(other.privilegeBits) && principalName.equals(other.principalName) && accessControlledPath.equals(other.accessControlledPath) && restrictions.equals(other.restrictions); } return false; }
@Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof AcEntry) { AcEntry other = (AcEntry) o; return isAllow == other.isAllow && privilegeBits.equals(other.privilegeBits) && principalName.equals(other.principalName) && accessControlledPath.equals(other.accessControlledPath) && restrictions.equals(other.restrictions); } return false; }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof ACE) { ACE other = (ACE) obj; return principal.getName().equals(other.principal.getName()) && isAllow == other.isAllow && privilegeBits.equals(other.privilegeBits) && restrictions.equals(other.restrictions); } return false; }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof ACE) { ACE other = (ACE) obj; return principal.getName().equals(other.principal.getName()) && isAllow == other.isAllow && privilegeBits.equals(other.privilegeBits) && restrictions.equals(other.restrictions); } return false; }
Set<Restriction> restrictions = restrictionProvider.readRestrictions(Strings.emptyToNull(accessControlledPath), treeProvider.createReadOnlyTree(ace)); AcEntry entry = (privilegeBits.equals(jcrAll)) ? new JcrAllAcEntry(ace, accessControlledPath, index, isAllow, privilegeBits, restrictions) : new AcEntry(ace, accessControlledPath, index, isAllow, privilegeBits, restrictions);
Set<Restriction> restrictions = restrictionProvider.readRestrictions(Strings.emptyToNull(accessControlledPath), treeProvider.createReadOnlyTree(ace)); AcEntry entry = (privilegeBits.equals(jcrAll)) ? new JcrAllAcEntry(ace, accessControlledPath, index, isAllow, privilegeBits, restrictions) : new AcEntry(ace, accessControlledPath, index, isAllow, privilegeBits, restrictions);
Set<Restriction> restrictions = restrictionProvider.readRestrictions(Strings.emptyToNull(accessControlledPath), treeProvider.createReadOnlyTree(ace)); AcEntry entry = (privilegeBits.equals(jcrAll)) ? new JcrAllAcEntry(ace, accessControlledPath, index, isAllow, privilegeBits, restrictions) : new AcEntry(ace, accessControlledPath, index, isAllow, privilegeBits, restrictions);
private void validateNext(PrivilegeBits bits) throws CommitFailedException { PrivilegeBits next = PrivilegeBits.getInstance(getPrivilegesTree(rootAfter).getProperty(REP_NEXT)); if (!next.equals(bits.nextBits())) { throw new CommitFailedException(CONSTRAINT, 43, "Next bits not updated"); } }
private void validateNext(PrivilegeBits bits) throws CommitFailedException { PrivilegeBits next = PrivilegeBits.getInstance(getPrivilegesTree(rootAfter).getProperty(REP_NEXT)); if (!next.equals(bits.nextBits())) { throw new CommitFailedException(CONSTRAINT, 43, "Next bits not updated"); } }
private void validateNext(PrivilegeBits bits) throws CommitFailedException { PrivilegeBits next = PrivilegeBits.getInstance(getPrivilegesTree(rootAfter).getProperty(REP_NEXT)); if (!next.equals(bits.nextBits())) { throw new CommitFailedException(CONSTRAINT, 43, "Next bits not updated"); } }
@Test public void testHasPrivileges() throws Exception { PrivilegeBitsProvider pbp = new PrivilegeBitsProvider(readOnlyRoot); PrivilegeBits readNodes = pbp.getBits(REP_READ_NODES); for (String path : defPrivileges.keySet()) { Set<String> defaultPrivs = defPrivileges.get(path); PrivilegeBits defaultBits = pbp.getBits(defaultPrivs); Tree tree = readOnlyRoot.getTree(path); if (defaultPrivs.isEmpty()) { assertFalse(path, cppTestUser.hasPrivileges(tree, REP_READ_NODES)); } else if (defaultBits.includes(readNodes)) { assertTrue(path, cppTestUser.hasPrivileges(tree, REP_READ_NODES)); if (!readNodes.equals(defaultBits)) { assertFalse(path, cppTestUser.hasPrivileges(tree, defaultPrivs.toArray(new String[defaultPrivs.size()]))); } } else { assertFalse(path, cppTestUser.hasPrivileges(tree, REP_READ_NODES)); assertFalse(path, cppTestUser.hasPrivileges(tree, defaultPrivs.toArray(new String[defaultPrivs.size()]))); } } }
@Test public void testNextBits() { // long based privilege bits PrivilegeBits pb = READ_NODES_PRIVILEGE_BITS; long l = getLongValue(pb); while (l < Long.MAX_VALUE / 2) { l = l << 1; pb = pb.nextBits(); assertEquals(l, getLongValue(pb)); } // other privilege bits: long value not available. for (int i = 0; i < 10; i++) { PrivilegeBits nxt = pb.nextBits(); assertEquals(nxt, pb.nextBits()); assertFalse(pb.equals(nxt)); pb = nxt; } // modifiable privilege bits pb = READ_NODES_PRIVILEGE_BITS; for (int i = 0; i < 100; i++) { PrivilegeBits modifiable = PrivilegeBits.getInstance(pb); try { modifiable.nextBits(); fail("UnsupportedOperation expected"); } catch (UnsupportedOperationException e) { // success } pb = pb.nextBits(); } }
assertTrue(tmp.includes(pb)); assertFalse(tmp.includes(nxt)); if (READ_NODES_PRIVILEGE_BITS.equals(pb)) { assertTrue(tmp.includes(PrivilegeBits.BUILT_IN.get(PrivilegeConstants.REP_READ_NODES))); } else { if (READ_NODES_PRIVILEGE_BITS.equals(pb)) { assertTrue(tmp.includes(READ_NODES_PRIVILEGE_BITS)); } else {