Class AdminEnvironment
java.lang.Object
org.gcube.informationsystem.resourceregistry.environments.Environment
org.gcube.informationsystem.resourceregistry.environments.SystemEnvironment
org.gcube.informationsystem.resourceregistry.environments.administration.AdminEnvironment
This SystemEnvironment is used in all the cases where the
operation must be done by an administrator.
- Author:
- Luca Frosini (ISTI - CNR)
-
Nested Class Summary
Nested classes/interfaces inherited from class org.gcube.informationsystem.resourceregistry.environments.Environment
Environment.PermissionMode, Environment.SecurityType -
Field Summary
Fields inherited from class org.gcube.informationsystem.resourceregistry.environments.Environment
allOperationAllowedRoles, CONTEXT_MANAGER, contextSubtreeOperationAllowedRoles, DEFAULT_READER_ROLE, DEFAULT_WRITER_ROLE, environmentUUID, INFRASTRUCTURE_MANAGER, instanceOperationAllowedRoles, IS_ADMIN, IS_INSTANCE_OPERATOR, IS_MANAGER, stateOverrideAllowedRoles -
Method Summary
Modifier and TypeMethodDescriptionprotected com.orientechnologies.orient.core.metadata.security.ORoleaddExtraRules(com.orientechnologies.orient.core.metadata.security.ORole role, Environment.PermissionMode permissionMode) Grants the admin roleBYPASS_RESTRICTEDon every resource, so it sees and can write every record regardless of the record-level security roles allowed/denied on it — write mode gets full (ORole#PERMISSION_ALL) bypass, read mode gets read-only (ORole#PERMISSION_READ) bypass.voidcreate()Unsupported forAdminEnvironment: the admin security context (roles/users withBYPASS_RESTRICTED) is bootstrapped once by the database initialization procedure, never created on demand like a regularEnvironment.static AdminEnvironmentReturns the singleton instance ofAdminEnvironment.protected com.orientechnologies.orient.core.metadata.security.ORolegetSuperRole(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity, Environment.PermissionMode permissionMode) Returns the database-wide administrator role ("admin") as the super role, instead of the plainreader/writersuper role every otherEnvironmentinherits from.Methods inherited from class org.gcube.informationsystem.resourceregistry.environments.Environment
addElement, addElement, allow, allowed, create, createRolesAndUsers, delete, delete, deleteRolesAndUsers, deny, drop, getAllOperationsAllowedRoles, getAllowedRoles, getDatabaseDocument, getInstanceOperationAllowedRoles, getOrCreateRole, getOrCreateUser, getPool, getRoleOrUserName, getSecurityRoleOrUserName, getStateOverrideAllowedRoles, getUUID, isElementInContext, isUserAllowed, removeElement, removeElement, toString
-
Method Details
-
getInstance
public static AdminEnvironment getInstance() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionReturns the singleton instance ofAdminEnvironment.- Returns:
- the singleton instance
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the environment cannot be initialized
-
create
public void create()Unsupported forAdminEnvironment: the admin security context (roles/users withBYPASS_RESTRICTED) is bootstrapped once by the database initialization procedure, never created on demand like a regularEnvironment.- Overrides:
createin classEnvironment- Throws:
RuntimeException- always, since this operation is not supported for the admin context
-
getSuperRole
protected com.orientechnologies.orient.core.metadata.security.ORole getSuperRole(com.orientechnologies.orient.core.metadata.security.OSecurity oSecurity, Environment.PermissionMode permissionMode) Returns the database-wide administrator role ("admin") as the super role, instead of the plainreader/writersuper role every otherEnvironmentinherits from.- Overrides:
getSuperRolein classEnvironment- Parameters:
oSecurity- the OrientDB security managerpermissionMode- the permission mode (unused: the same admin role is returned regardless)- Returns:
- the OrientDB administrator role
-
addExtraRules
protected com.orientechnologies.orient.core.metadata.security.ORole addExtraRules(com.orientechnologies.orient.core.metadata.security.ORole role, Environment.PermissionMode permissionMode) Grants the admin roleBYPASS_RESTRICTEDon every resource, so it sees and can write every record regardless of the record-level security roles allowed/denied on it — write mode gets full (ORole#PERMISSION_ALL) bypass, read mode gets read-only (ORole#PERMISSION_READ) bypass.- Overrides:
addExtraRulesin classEnvironment- Parameters:
role- the role to modifypermissionMode- the permission mode defining which bypass permission to grant- Returns:
- the modified role
-