@Override public void incrementVersion() { delegate.incrementVersion(); } }
/** * Create the user by reading the source document. */ public OUser(final ODocument iSource) { fromStream(iSource); }
public OImmutableRole(ORole role) { if (role.getParentRole() == null) this.parentRole = null; else this.parentRole = new OImmutableRole(role.getParentRole()); this.mode = role.getMode(); this.name = role.getName(); this.rid = role.getIdentity().getIdentity(); this.role = role; for (ORule rule : role.getRuleSet()) rules.put(rule.getResourceGeneric(), rule); }
@Override public OIdentifiable allowRole(final ODocument iDocument, final ORestrictedOperation iOperation, final String iRoleName) { final ORID role = getRoleRID(iRoleName); if (role == null) throw new IllegalArgumentException("Role '" + iRoleName + "' not found"); return allowIdentity(iDocument, iOperation.getFieldName(), role); }
@Override public ODocument getDocument() { return user.getDocument(); }
public boolean allow(final ORule.ResourceGeneric resourceGeneric, String resourceSpecific, final int iCRUDOperation) { final ORule rule = rules.get(resourceGeneric); if (rule != null) { final Boolean allowed = rule.isAllowed(resourceSpecific, iCRUDOperation); if (allowed != null) return allowed; } if (parentRole != null) // DELEGATE TO THE PARENT ROLE IF ANY return parentRole.allow(resourceGeneric, resourceSpecific, iCRUDOperation); return mode == ALLOW_MODES.ALLOW_ALL_BUT; }
public ORole addRule(final ORule.ResourceGeneric resourceGeneric, String resourceSpecific, final int iOperation) { ORule rule = rules.get(resourceGeneric); if (rule == null) { rule = new ORule(resourceGeneric, null, null); rules.put(resourceGeneric, rule); } rule.grantAccess(resourceSpecific, iOperation); rules.put(resourceGeneric, rule); updateRolesDocumentContent(); return this; }
/** * Derived classes can override createRole() to return an extended ORole implementation or null if the role should not be added. */ protected ORole createRole(final ODocument roleDoc) { return new ORole(roleDoc); }
@Override public ODocument getDocument() { return role.getDocument(); } }
@Override public String toString() { return getName(); }
/** * dbName is the name of the source database and is used for filtering roles. */ public OSystemUser(final ODocument iSource, final String dbName) { databaseName = dbName; fromStream(iSource); }
public OSecurity newSecurity() { return new OSecurityShared(); } }
@Override public String toString() { return getName(); }
@Override public OIdentifiable disallowIdentity(ODocument iDocument, String iAllowFieldName, OIdentifiable iId) { return delegate.disallowIdentity(iDocument, iAllowFieldName, iId); }
/** * Create the role by reading the source document. */ public ORole(final ODocument iSource) { fromStream(iSource); }
protected ResourceGeneric(String name, String legacyName) { this.name = name; this.legacyName = legacyName != null ? legacyName : name; register(this); }
@Override public long getVersion() { return delegate.getVersion(); }
@Override public void incrementVersion() { delegate.incrementVersion(); } }