public class OSecurityShared extends Object implements OSecurityInternal
Modifier and Type | Field and Description |
---|---|
static String |
ALLOW_ALL_FIELD
Deprecated.
|
static String |
ALLOW_DELETE_FIELD
Deprecated.
|
static Set<String> |
ALLOW_FIELDS |
static String |
ALLOW_READ_FIELD
Deprecated.
|
static String |
ALLOW_UPDATE_FIELD
Deprecated.
|
protected Set<OSecurityResourceProperty> |
filteredProperties
set of all the security resources defined on properties (used for optimizations)
|
static String |
IDENTITY_CLASSNAME |
static String |
ONCREATE_FIELD |
static String |
ONCREATE_IDENTITY_TYPE |
static String |
RESTRICTED_CLASSNAME |
protected Map<String,Map<String,Boolean>> |
roleHasPredicateSecurityForClass
role name -> class name -> true: has some rules, ie.
|
protected Map<String,Map<String,OBooleanExpression>> |
securityPredicateCache |
protected boolean |
skipRoleHasPredicateSecurityForClassUpdate |
Constructor and Description |
---|
OSecurityShared() |
public static final String RESTRICTED_CLASSNAME
public static final String IDENTITY_CLASSNAME
protected Map<String,Map<String,Boolean>> roleHasPredicateSecurityForClass
protected boolean skipRoleHasPredicateSecurityForClassUpdate
protected Map<String,Map<String,OBooleanExpression>> securityPredicateCache
protected Set<OSecurityResourceProperty> filteredProperties
@Deprecated public static final String ALLOW_ALL_FIELD
@Deprecated public static final String ALLOW_READ_FIELD
@Deprecated public static final String ALLOW_UPDATE_FIELD
@Deprecated public static final String ALLOW_DELETE_FIELD
public static final String ONCREATE_IDENTITY_TYPE
public static final String ONCREATE_FIELD
public OIdentifiable allowRole(ODatabaseSession session, ODocument iDocument, ORestrictedOperation iOperation, String iRoleName)
allowRole
in interface OSecurityInternal
public OIdentifiable allowUser(ODatabaseSession session, ODocument iDocument, ORestrictedOperation iOperation, String iUserName)
allowUser
in interface OSecurityInternal
public OIdentifiable allowIdentity(ODatabaseSession session, ODocument iDocument, String iAllowFieldName, OIdentifiable iId)
allowIdentity
in interface OSecurityInternal
public OIdentifiable denyUser(ODatabaseSession session, ODocument iDocument, ORestrictedOperation iOperation, String iUserName)
denyUser
in interface OSecurityInternal
public OIdentifiable denyRole(ODatabaseSession session, ODocument iDocument, ORestrictedOperation iOperation, String iRoleName)
denyRole
in interface OSecurityInternal
public OIdentifiable disallowIdentity(ODatabaseSession session, ODocument iDocument, String iAllowFieldName, OIdentifiable iId)
disallowIdentity
in interface OSecurityInternal
public boolean isAllowed(ODatabaseSession session, Set<OIdentifiable> iAllowAll, Set<OIdentifiable> iAllowOperation)
isAllowed
in interface OSecurityInternal
public OUser authenticate(ODatabaseSession session, String iUserName, String iUserPassword)
authenticate
in interface OSecurityInternal
public OUser authenticate(ODatabaseSession session, OToken authToken)
authenticate
in interface OSecurityInternal
public OUser getUser(ODatabaseSession session, ORID iRecordId)
getUser
in interface OSecurityInternal
public OUser createUser(ODatabaseSession session, String iUserName, String iUserPassword, String... iRoles)
createUser
in interface OSecurityInternal
public OUser createUser(ODatabaseSession session, String userName, String userPassword, ORole... roles)
createUser
in interface OSecurityInternal
public boolean dropUser(ODatabaseSession session, String iUserName)
dropUser
in interface OSecurityInternal
public ORole getRole(ODatabaseSession session, OIdentifiable iRole)
getRole
in interface OSecurityInternal
public ORole getRole(ODatabaseSession session, String iRoleName)
getRole
in interface OSecurityInternal
public ORID getRoleRID(ODatabaseSession session, String iRoleName)
public ORole createRole(ODatabaseSession session, String iRoleName, OSecurityRole.ALLOW_MODES iAllowMode)
createRole
in interface OSecurityInternal
public ORole createRole(ODatabaseSession session, String iRoleName, ORole iParent, OSecurityRole.ALLOW_MODES iAllowMode)
createRole
in interface OSecurityInternal
public boolean dropRole(ODatabaseSession session, String iRoleName)
dropRole
in interface OSecurityInternal
public List<ODocument> getAllUsers(ODatabaseSession session)
getAllUsers
in interface OSecurityInternal
public List<ODocument> getAllRoles(ODatabaseSession session)
getAllRoles
in interface OSecurityInternal
public Map<String,OSecurityPolicy> getSecurityPolicies(ODatabaseSession session, OSecurityRole role)
getSecurityPolicies
in interface OSecurityInternal
public OSecurityPolicy getSecurityPolicy(ODatabaseSession session, OSecurityRole role, String resource)
OSecurityInternal
getSecurityPolicy
in interface OSecurityInternal
session
- an active DB sessionrole
- the roleresource
- the string representation of the security resource, eg. "database.class.Person"public void setSecurityPolicyWithBitmask(ODatabaseSession session, OSecurityRole role, String resource, int legacyPolicy)
public void setSecurityPolicy(ODatabaseSession session, OSecurityRole role, String resource, OSecurityPolicy policy)
OSecurityInternal
setSecurityPolicy
in interface OSecurityInternal
session
- a valid db session to perform the operation (that has permissions to do it)role
- The roleresource
- the string representation of the security resource, eg. "database.class.Person"policy
- The security policypublic OSecurityPolicy createSecurityPolicy(ODatabaseSession session, String name)
OSecurityInternal
createSecurityPolicy
in interface OSecurityInternal
session
- the session to a DB where the policy has to be createdname
- the policy namepublic OSecurityPolicy getSecurityPolicy(ODatabaseSession session, String name)
getSecurityPolicy
in interface OSecurityInternal
public void saveSecurityPolicy(ODatabaseSession session, OSecurityPolicy policy)
saveSecurityPolicy
in interface OSecurityInternal
public void deleteSecurityPolicy(ODatabaseSession session, String name)
deleteSecurityPolicy
in interface OSecurityInternal
public void removeSecurityPolicy(ODatabaseSession session, ORole role, String resource)
OSecurityInternal
removeSecurityPolicy
in interface OSecurityInternal
session
- A valid db session to perform the operationrole
- the roleresource
- the string representation of the security resource, eg. "database.class.Person"public OUser create(ODatabaseSession session)
create
in interface OSecurityInternal
public OUser createMetadata(ODatabaseSession session)
public void load(ODatabaseSession session)
load
in interface OSecurityInternal
public void createClassTrigger(ODatabaseSession session)
createClassTrigger
in interface OSecurityInternal
public OUser getUser(ODatabaseSession session, String iUserName)
getUser
in interface OSecurityInternal
public ORID getUserRID(ODatabaseSession session, String userName)
public void close()
close
in interface OSecurityInternal
public long getVersion(ODatabaseSession session)
getVersion
in interface OSecurityInternal
public void incrementVersion(ODatabaseSession session)
incrementVersion
in interface OSecurityInternal
protected void initPredicateSecurityOptimizations(ODatabaseSession session)
public Set<String> getFilteredProperties(ODatabaseSession session, ODocument document)
OSecurityInternal
getFilteredProperties
in interface OSecurityInternal
session
- the db sessiondocument
- the document to filterpublic boolean isAllowedWrite(ODatabaseSession session, ODocument document, String propertyName)
OSecurityInternal
isAllowedWrite
in interface OSecurityInternal
document
- current document to check for proeprty-level securitypropertyName
- the property to check for write accesspublic boolean canCreate(ODatabaseSession session, ORecord record)
canCreate
in interface OSecurityInternal
public boolean canRead(ODatabaseSession session, ORecord record)
canRead
in interface OSecurityInternal
public boolean canUpdate(ODatabaseSession session, ORecord record)
canUpdate
in interface OSecurityInternal
public static OResultInternal calculateBefore(ODocument iDocument, ODatabaseSession db)
public boolean canDelete(ODatabaseSession session, ORecord record)
canDelete
in interface OSecurityInternal
public boolean canExecute(ODatabaseSession session, OFunction function)
canExecute
in interface OSecurityInternal
protected OBooleanExpression getPredicateFromCache(String roleName, String key)
protected void putPredicateInCache(String roleName, String key, OBooleanExpression predicate)
public boolean isReadRestrictedBySecurityPolicy(ODatabaseSession session, String resource)
OSecurityInternal
isReadRestrictedBySecurityPolicy
in interface OSecurityInternal
session
- The session to check for the existece of policiesresource
- a resource string, eg. "database.class.Person"public Set<OSecurityResourceProperty> getAllFilteredProperties(ODatabaseDocumentInternal database)
OSecurityInternal
getAllFilteredProperties
in interface OSecurityInternal
protected void updateAllFilteredProperties(ODatabaseDocumentInternal session)
protected void updateAllFilteredPropertiesInternal(ODatabaseDocumentInternal session)
protected Set<OSecurityResourceProperty> calculateAllFilteredProperties(ODatabaseSession session)
public boolean couldHaveActivePredicateSecurityRoles(ODatabaseSession session, String className)
Copyright © 2009–2020 OrientDB. All rights reserved.