@Override @Deprecated public OSecurityRole checkIfAllowed(String iResource, int iOperation) { final String resourceSpecific = ORule.mapLegacyResourceToSpecificResource(iResource); final ORule.ResourceGeneric resourceGeneric = ORule.mapLegacyResourceToGenericResource(iResource); if (resourceSpecific == null || resourceSpecific.equals("*")) return checkIfAllowed(resourceGeneric, null, iOperation); return checkIfAllowed(resourceGeneric, resourceSpecific, iOperation); }
public OSecurityRole allow(final ORule.ResourceGeneric resourceGeneric, final String resourceSpecific, final int iOperation) { if (roles.isEmpty()) throw new OSecurityAccessException(getName(), "User '" + getName() + "' has no role defined"); final OSecurityRole role = checkIfAllowed(resourceGeneric, resourceSpecific, iOperation); if (role == null) throw new OSecurityAccessException(getName(), "User '" + getName() + "' does not have permission to execute the operation '" + ORole.permissionToString(iOperation) + "' against the resource: " + resourceGeneric + "." + resourceSpecific); return role; }
public void reloadUser() { if (user != null) { activateOnCurrentThread(); if (user.checkIfAllowed(ORule.ResourceGeneric.CLASS, OUser.CLASS_NAME, ORole.PERMISSION_READ) != null) { OMetadata metadata = getMetadata(); if (metadata != null) { final OSecurity security = metadata.getSecurity(); OUser secGetUser = security.getUser(user.getName()); if (secGetUser != null) user = new OImmutableUser(security.getVersion(), secGetUser); else user = new OImmutableUser(-1, new OUser()); } else user = new OImmutableUser(-1, new OUser()); } } }