public class AuthorizationEntity extends Object implements Authorization, DbEntity, HasDbRevision, HasDbReferences, Serializable
Modifier and Type | Field and Description |
---|---|
protected int |
authorizationType |
protected String |
groupId |
protected String |
id |
protected static EnginePersistenceLogger |
LOG |
protected int |
permissions |
protected String |
resourceId |
protected Integer |
resourceType |
protected int |
revision |
protected String |
userId |
ANY, AUTH_TYPE_GLOBAL, AUTH_TYPE_GRANT, AUTH_TYPE_REVOKE
Constructor and Description |
---|
AuthorizationEntity() |
AuthorizationEntity(int type) |
Modifier and Type | Method and Description |
---|---|
void |
addPermission(Permission p)
allows granting a permission.
|
int |
getAuthorizationType()
The type og the authorization.
|
Set<Permission> |
getCachedPermissions() |
Map<String,Class> |
getDependentEntities()
Scope: PERSISTED references
|
String |
getGroupId() |
String |
getId() |
int |
getPermissions() |
Permission[] |
getPermissions(Permission[] permissions)
Allows checking whether this authorization grants / revokes a set of permissions.
|
Object |
getPersistentState()
Returns a representation of the object,
as would be stored in the database.
|
Map<String,Class> |
getReferencedEntitiesIdAndClass()
Scope: IN-MEMORY references
|
Set<String> |
getReferencedEntityIds()
Scope: IN-MEMORY references
|
Integer |
getResource() |
String |
getResourceId() |
int |
getResourceType() |
int |
getRevision() |
int |
getRevisionNext() |
String |
getUserId() |
boolean |
isEveryPermissionGranted()
Allows checking whether this authorization grants every single permission.
|
boolean |
isEveryPermissionRevoked()
Allows checking whether this authorization revokes every single permission.
|
boolean |
isPermissionGranted(Permission p)
Allows checking whether this authorization grants a specific permission.
|
boolean |
isPermissionRevoked(Permission p)
Allows checking whether this authorization revokes a specific permission.
|
void |
removePermission(Permission p)
allows removing a permission.
|
protected void |
resetPermissions() |
void |
setAuthorizationType(int authorizationType) |
void |
setGroupId(String groupId)
set the id of the group this authorization is created for
|
void |
setId(String id) |
void |
setPermissions(int permissions) |
void |
setPermissions(Permission[] permissions)
Sets the permissions to the provided value.
|
void |
setResource(Resource resource)
sets the type of the resource
|
void |
setResourceId(String resourceId)
set the id of the resource
|
void |
setResourceType(int type)
sets the type of the resource
|
void |
setRevision(int revision) |
void |
setUserId(String userId)
set the id of the user this authorization is created for
|
String |
toString() |
protected static final EnginePersistenceLogger LOG
protected String id
protected int revision
protected int authorizationType
protected int permissions
protected String userId
protected String groupId
protected Integer resourceType
protected String resourceId
public AuthorizationEntity()
public AuthorizationEntity(int type)
protected void resetPermissions()
public void addPermission(Permission p)
Authorization
Permissions
.addPermission
in interface Authorization
public void removePermission(Permission p)
Authorization
Permissions
.removePermission
in interface Authorization
public boolean isPermissionGranted(Permission p)
Authorization
isPermissionGranted
in interface Authorization
public boolean isPermissionRevoked(Permission p)
Authorization
isPermissionRevoked
in interface Authorization
public boolean isEveryPermissionGranted()
Authorization
isEveryPermissionGranted
in interface Authorization
public boolean isEveryPermissionRevoked()
Authorization
isEveryPermissionRevoked
in interface Authorization
public Permission[] getPermissions(Permission[] permissions)
Authorization
Permissions.values()
The return value of this method depends on the type of the authorization:
Authorization.AUTH_TYPE_GLOBAL
: all permissions in the parameter list granted by this authorization are returned. Authorization.AUTH_TYPE_GRANT
: all permissions in the parameter list granted by this authorization are returned. Authorization.AUTH_TYPE_REVOKE
: all permissions in the parameter list revoked by this authorization are returned. getPermissions
in interface Authorization
Permissions
provided by this Authorization
.public void setPermissions(Permission[] permissions)
Authorization
Authorization.AUTH_TYPE_GLOBAL
: all provided permissions are granted.Authorization.AUTH_TYPE_GRANT
: all provided permissions are granted.Authorization.AUTH_TYPE_REVOKE
: all provided permissions are revoked.setPermissions
in interface Authorization
public int getAuthorizationType()
Authorization
getAuthorizationType
in interface Authorization
public void setAuthorizationType(int authorizationType)
public String getGroupId()
getGroupId
in interface Authorization
public void setGroupId(String groupId)
Authorization
setGroupId
in interface Authorization
public String getUserId()
getUserId
in interface Authorization
public void setUserId(String userId)
Authorization
setUserId
in interface Authorization
public int getResourceType()
getResourceType
in interface Authorization
public void setResourceType(int type)
Authorization
setResourceType
in interface Authorization
public Integer getResource()
public void setResource(Resource resource)
Authorization
setResource
in interface Authorization
public String getResourceId()
getResourceId
in interface Authorization
public void setResourceId(String resourceId)
Authorization
setResourceId
in interface Authorization
public String getId()
getId
in interface Authorization
getId
in interface DbEntity
Authorization
objectpublic int getRevision()
getRevision
in interface HasDbRevision
public void setRevision(int revision)
setRevision
in interface HasDbRevision
public void setPermissions(int permissions)
public int getPermissions()
public Set<Permission> getCachedPermissions()
public int getRevisionNext()
getRevisionNext
in interface HasDbRevision
public Object getPersistentState()
DbEntity
getPersistentState
in interface DbEntity
public Set<String> getReferencedEntityIds()
HasDbReferences
Scope: IN-MEMORY references
getReferencedEntityIds
in interface HasDbReferences
public Map<String,Class> getReferencedEntitiesIdAndClass()
HasDbReferences
Scope: IN-MEMORY references
getReferencedEntitiesIdAndClass
in interface HasDbReferences
public Map<String,Class> getDependentEntities()
HasDbReferences
Scope: PERSISTED references
getDependentEntities
in interface HasDbReferences
Copyright © 2022. All rights reserved.