public boolean removeACL(ACL acl) { return this.removeACL(acl.getResource()); }
public boolean removeACL(ACL acl) { return this.removeACL(acl.getResource()); }
@Override public boolean equals(Object obj) { if (obj instanceof BitMaskPermission) return this.mask == ((BitMaskPermission) obj).getMaskValue(); return false; }
public boolean addEntry(ACLEntry entry) { if (this.entriesMap == null) this.initEntriesMap(); // don't add a null entry or an entry that already existSELECT * FROM ACL_ENTRYs. if (entry == null || this.entriesMap.get(entry.getIdentityOrRole()) != null) return false; this.entries.add((ACLEntryImpl) entry); ((ACLEntryImpl) entry).setAcl(this); this.entriesMap.put(entry.getIdentityOrRole(), entry); return true; }
public boolean isGranted(ACLPermission permission, Identity identity) { if (this.entriesMap == null) this.initEntriesMap(); // lookup the entry corresponding to the specified identity. ACLEntry entry = this.entriesMap.get(identity.getName()); if (entry != null) { // check the permission associated with the identity. return entry.checkPermission(permission); } return false; }
public boolean removeEntry(ACLEntry entry) { if (this.entriesMap == null) this.initEntriesMap(); this.entriesMap.remove(entry.getIdentityOrRole()); return this.entries.remove(entry); }
/** * <p> * Builds an instance of {@code CompositeACLPermission} with the given basic permissions. * </p> * * @param permissions a comma-separated list of {@code BasicACLPermission}s. */ public CompositeACLPermission(BasicACLPermission... permissions) { for (BasicACLPermission basicPermission : permissions) { this.mask |= basicPermission.getMaskValue(); } }
/** * <p> * Builds an instance of {@code ACLImpl} for the specified resource, and initialize it with the specified entries. * </p> * * @param resource a reference to the {@code Resource} associated with the ACL being constructed. * @param entries a {@code Collection} containing the ACL's initial entries. */ public ACLImpl(Resource resource, Collection<ACLEntry> entries) { this(Util.getResourceAsString(resource), entries); this.resource = resource; }
public Object instantiate() { return new ACLEntryImpl(this.permission, this.identity); }
public boolean addEntry(ACLEntry entry) { if (this.entriesMap == null) this.initEntriesMap(); // don't add a null entry or an entry that already existSELECT * FROM ACL_ENTRYs. if (entry == null || this.entriesMap.get(entry.getIdentityOrRole()) != null) return false; this.entries.add((ACLEntryImpl) entry); ((ACLEntryImpl) entry).setAcl(this); this.entriesMap.put(entry.getIdentityOrRole(), entry); return true; }
public boolean checkPermission(ACLPermission permission) { if (!(permission instanceof BitMaskPermission)) return false; BitMaskPermission bitmaskPermission = (BitMaskPermission) permission; // an empty permission is always part of another permission. if (bitmaskPermission.getMaskValue() == 0) return true; // simple implementation: if all bits match, return true. return (this.permission.getMaskValue() & bitmaskPermission.getMaskValue()) == bitmaskPermission.getMaskValue(); }
public boolean removeACL(ACL acl) { return this.removeACL(acl.getResource()); }
public boolean removeEntry(ACLEntry entry) { if (this.entriesMap == null) this.initEntriesMap(); this.entriesMap.remove(entry.getIdentityOrRole()); return this.entries.remove(entry); }
/** * <p> * Builds an instance of {@code CompositeACLPermission} with the given basic permissions. * </p> * * @param permissions a comma-separated list of {@code BasicACLPermission}s. */ public CompositeACLPermission(BasicACLPermission... permissions) { for (BasicACLPermission basicPermission : permissions) { this.mask |= basicPermission.getMaskValue(); } }
/** * <p> * Builds an instance of {@code ACLImpl} for the specified resource, and initialize it with the specified entries. * </p> * * @param resource a reference to the {@code Resource} associated with the ACL being constructed. * @param entries a {@code Collection} containing the ACL's initial entries. */ public ACLImpl(Resource resource, Collection<ACLEntry> entries) { this(Util.getResourceAsString(resource), entries); this.resource = resource; }
public boolean checkPermission(ACLPermission permission) { if (!(permission instanceof BitMaskPermission)) return false; BitMaskPermission bitmaskPermission = (BitMaskPermission) permission; // an empty permission is always part of another permission. if (bitmaskPermission.getMaskValue() == 0) return true; // simple implementation: if all bits match, return true. return (this.permission.getMaskValue() & bitmaskPermission.getMaskValue()) == bitmaskPermission.getMaskValue(); }
/** * <p> * Builds an instance of <code>CompositeACLPermission</code> with the given basic permissions. * </p> * * @param permissions a comma-separated list of <code>BasicACLPermission</code>s. */ public CompositeACLPermission(BasicACLPermission... permissions) { for (BasicACLPermission basicPermission : permissions) { this.mask |= basicPermission.getMaskValue(); } }
@Override public boolean equals(Object obj) { if (obj instanceof BitMaskPermission) return this.mask == ((BitMaskPermission) obj).getMaskValue(); return false; }
@Override public boolean equals(Object obj) { if (obj instanceof BitMaskPermission) return this.mask == ((BitMaskPermission) obj).getMaskValue(); return false; }
public boolean checkPermission(ACLPermission permission) { if (!(permission instanceof BitMaskPermission)) return false; BitMaskPermission bitmaskPermission = (BitMaskPermission) permission; // an empty permission is always part of another permission. if (bitmaskPermission.getMaskValue() == 0) return true; // simple implementation: if any bit matches, return true. return (this.permission.getMaskValue() & bitmaskPermission.getMaskValue()) != 0; } }