@Deprecated @Override public boolean allow(String iResource, int iCRUDOperation) { final String specificResource = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (specificResource == null || specificResource.equals("*")) return allow(resourceGeneric, null, iCRUDOperation); return allow(resourceGeneric, specificResource, iCRUDOperation); }
@Override public String toString() { return getName(); }
@Deprecated @Override public boolean hasRule(String iResource) { final String specificResource = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (specificResource == null || specificResource.equals("*")) return hasRule(resourceGeneric, null); return hasRule(resourceGeneric, specificResource); }
public OImmutableUser(long version, OUser user) { this.version = version; this.name = user.getName(); this.password = user.getPassword(); this.status = user.getAccountStatus(); this.rid = user.getIdentity().getIdentity(); this.user = user; for (ORole role : user.getRoles()) { roles.add(new OImmutableRole(role)); } }
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); }
public boolean isRuleDefined(final ORule.ResourceGeneric resourceGeneric, String resourceSpecific) { for (OImmutableRole r : roles) if (r == null) OLogManager.instance().warn(this, "User '%s' has a null role, ignoring it. Consider fixing this user's roles before continuing", getName()); else if (r.hasRule(resourceGeneric, resourceSpecific)) return true; return false; }
public OSecurityRole checkIfAllowed(final ORule.ResourceGeneric resourceGeneric, final String resourceSpecific, final int iOperation) { for (OImmutableRole r : roles) { if (r == null) OLogManager.instance().warn(this, "User '%s' has a null role, ignoring it. Consider fixing this user's roles before continuing", getName()); else if (r.allow(resourceGeneric, resourceSpecific, iOperation)) return r; } return null; }