Class AuthorizationManager
- java.lang.Object
-
- org.camunda.bpm.engine.impl.persistence.AbstractManager
-
- org.camunda.bpm.engine.impl.persistence.entity.AuthorizationManager
-
- All Implemented Interfaces:
Session
public class AuthorizationManager extends AbstractManager
- Author:
- Daniel Meyer
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<java.lang.String>
availableAuthorizedGroupIds
Group ids for which authorizations exist in the database.protected static java.util.List<java.lang.String>
EMPTY_LIST
protected java.lang.Boolean
isRevokeAuthCheckUsed
protected static EnginePersistenceLogger
LOG
-
Constructor Summary
Constructors Constructor Description AuthorizationManager()
-
Method Summary
-
Methods inherited from class org.camunda.bpm.engine.impl.persistence.AbstractManager
close, deleteAuthorizations, deleteAuthorizationsForGroup, deleteAuthorizationsForUser, deleteDefaultAuthorizations, flush, getAttachmentManager, getAuthorizationManager, getBatchManager, getByteArrayManager, getCamundaFormDefinitionManager, getCaseDefinitionManager, getCaseExecutionManager, getCaseInstanceManager, getCommandContext, getCurrentAuthentication, getDbEntityManager, getDbSqlSession, getDecisionDefinitionManager, getDecisionRequirementsDefinitionManager, getDeploymentManager, getEventSubscriptionManager, getHistoricActivityInstanceManager, getHistoricBatchManager, getHistoricCaseActivityInstanceManager, getHistoricCaseInstanceManager, getHistoricDecisionInstanceManager, getHistoricDetailManager, getHistoricExternalTaskLogManager, getHistoricIdentityLinkManager, getHistoricIncidentManager, getHistoricJobLogManager, getHistoricProcessInstanceManager, getHistoricReportManager, getHistoricTaskInstanceManager, getHistoricVariableInstanceManager, getIdentityInfoManager, getIdentityLinkManager, getJobDefinitionManager, getJobManager, getProcessDefinitionManager, getProcessInstanceManager, getResourceAuthorizationProvider, getResourceManager, getSession, getTaskManager, getTaskReportManager, getTenantManager, getUserOperationLogManager, getVariableInstanceManager, isAuthorizationEnabled, saveDefaultAuthorizations
-
-
-
-
Field Detail
-
LOG
protected static final EnginePersistenceLogger LOG
-
EMPTY_LIST
protected static final java.util.List<java.lang.String> EMPTY_LIST
-
availableAuthorizedGroupIds
protected java.util.Set<java.lang.String> availableAuthorizedGroupIds
Group ids for which authorizations exist in the database. This is initialized once per command by thefilterAuthenticatedGroupIds(List)
method. (Manager instances are command scoped). It is used to only check authorizations for groups for which authorizations exist. In other words, if for a given group no authorization exists in the DB, then auth checks are not performed for this group.
-
isRevokeAuthCheckUsed
protected java.lang.Boolean isRevokeAuthCheckUsed
-
-
Method Detail
-
newPermissionCheckBuilder
public PermissionCheckBuilder newPermissionCheckBuilder()
-
createNewAuthorization
public Authorization createNewAuthorization(int type)
-
insert
public void insert(DbEntity authorization)
- Overrides:
insert
in classAbstractManager
-
selectAuthorizationByQueryCriteria
public java.util.List<Authorization> selectAuthorizationByQueryCriteria(AuthorizationQueryImpl authorizationQuery)
-
selectAuthorizationCountByQueryCriteria
public java.lang.Long selectAuthorizationCountByQueryCriteria(AuthorizationQueryImpl authorizationQuery)
-
findAuthorizationByUserIdAndResourceId
public AuthorizationEntity findAuthorizationByUserIdAndResourceId(int type, java.lang.String userId, Resource resource, java.lang.String resourceId)
-
findAuthorizationByGroupIdAndResourceId
public AuthorizationEntity findAuthorizationByGroupIdAndResourceId(int type, java.lang.String groupId, Resource resource, java.lang.String resourceId)
-
findAuthorization
public AuthorizationEntity findAuthorization(int type, java.lang.String userId, java.lang.String groupId, Resource resource, java.lang.String resourceId)
-
update
public void update(AuthorizationEntity authorization)
-
delete
public void delete(DbEntity authorization)
- Overrides:
delete
in classAbstractManager
-
checkAuthorization
public void checkAuthorization(CompositePermissionCheck compositePermissionCheck)
-
checkAuthorization
public void checkAuthorization(Permission permission, Resource resource)
-
checkAuthorization
public void checkAuthorization(Permission permission, Resource resource, java.lang.String resourceId)
- Overrides:
checkAuthorization
in classAbstractManager
-
isAuthorized
public boolean isAuthorized(Permission permission, Resource resource, java.lang.String resourceId)
-
isAuthorized
public boolean isAuthorized(java.lang.String userId, java.util.List<java.lang.String> groupIds, Permission permission, Resource resource, java.lang.String resourceId)
-
isAuthorized
public boolean isAuthorized(java.lang.String userId, java.util.List<java.lang.String> groupIds, PermissionCheck permissionCheck)
-
isRevokeAuthCheckEnabled
protected boolean isRevokeAuthCheckEnabled(java.lang.String userId, java.util.List<java.lang.String> groupIds)
-
createCompositePermissionCheck
protected CompositePermissionCheck createCompositePermissionCheck(PermissionCheck permissionCheck)
-
isAuthorized
public boolean isAuthorized(java.lang.String userId, java.util.List<java.lang.String> groupIds, CompositePermissionCheck compositePermissionCheck)
-
isAuthorized
public boolean isAuthorized(CompositePermissionCheck compositePermissionCheck)
-
isResourceValidForPermission
protected boolean isResourceValidForPermission(PermissionCheck permissionCheck)
-
validateResourceCompatibility
public void validateResourceCompatibility(AuthorizationEntity authorization)
-
configureQuery
public void configureQuery(ListQueryParameterObject query)
-
configureQueryHistoricFinishedInstanceReport
public void configureQueryHistoricFinishedInstanceReport(ListQueryParameterObject query, Resource resource)
-
enableQueryAuthCheck
public void enableQueryAuthCheck(AuthorizationCheck authCheck)
-
configureQuery
public void configureQuery(AbstractQuery query, Resource resource)
- Overrides:
configureQuery
in classAbstractManager
-
configureQuery
public void configureQuery(AbstractQuery query, Resource resource, java.lang.String queryParam)
-
configureQuery
public void configureQuery(AbstractQuery query, Resource resource, java.lang.String queryParam, Permission permission)
-
isPermissionDisabled
public boolean isPermissionDisabled(Permission permission)
-
addPermissionCheck
protected void addPermissionCheck(AuthorizationCheck authCheck, CompositePermissionCheck compositeCheck)
-
deleteAuthorizationsByResourceIds
public void deleteAuthorizationsByResourceIds(Resources resource, java.util.List<java.lang.String> resourceIds)
-
deleteAuthorizationsByResourceId
public void deleteAuthorizationsByResourceId(Resource resource, java.lang.String resourceId)
-
deleteAuthorizationsByResourceIdAndUserId
public void deleteAuthorizationsByResourceIdAndUserId(Resource resource, java.lang.String resourceId, java.lang.String userId)
-
deleteAuthorizationsByResourceIdAndGroupId
public void deleteAuthorizationsByResourceIdAndGroupId(Resource resource, java.lang.String resourceId, java.lang.String groupId)
-
checkCamundaAdmin
public void checkCamundaAdmin()
Checks if the current authentication contains the groupGroups.CAMUNDA_ADMIN
. The check is ignored if the authorization is disabled or no authentication exists.- Throws:
AuthorizationException
-
isCamundaAdmin
public boolean isCamundaAdmin(Authentication authentication)
- Parameters:
authentication
- authentication to check, cannot benull
- Returns:
true
if the given authentication contains the groupGroups.CAMUNDA_ADMIN
or the user
-
configureDeploymentQuery
public void configureDeploymentQuery(DeploymentQueryImpl query)
-
configureProcessDefinitionQuery
public void configureProcessDefinitionQuery(ProcessDefinitionQueryImpl query)
-
configureExecutionQuery
public void configureExecutionQuery(AbstractQuery query)
-
configureTaskQuery
public void configureTaskQuery(TaskQueryImpl query)
-
configureEventSubscriptionQuery
public void configureEventSubscriptionQuery(EventSubscriptionQueryImpl query)
-
configureConditionalEventSubscriptionQuery
public void configureConditionalEventSubscriptionQuery(ListQueryParameterObject query)
-
configureIncidentQuery
public void configureIncidentQuery(IncidentQueryImpl query)
-
configureVariableInstanceQuery
protected void configureVariableInstanceQuery(VariableInstanceQueryImpl query)
-
configureJobDefinitionQuery
public void configureJobDefinitionQuery(JobDefinitionQueryImpl query)
-
configureJobQuery
public void configureJobQuery(JobQueryImpl query)
-
configureHistoricProcessInstanceQuery
public void configureHistoricProcessInstanceQuery(HistoricProcessInstanceQueryImpl query)
-
configureHistoricActivityInstanceQuery
public void configureHistoricActivityInstanceQuery(HistoricActivityInstanceQueryImpl query)
-
configureHistoricTaskInstanceQuery
public void configureHistoricTaskInstanceQuery(HistoricTaskInstanceQueryImpl query)
-
configureHistoricVariableInstanceQuery
public void configureHistoricVariableInstanceQuery(HistoricVariableInstanceQueryImpl query)
-
configureHistoricDetailQuery
public void configureHistoricDetailQuery(HistoricDetailQueryImpl query)
-
configureHistoricVariableAndDetailQuery
protected void configureHistoricVariableAndDetailQuery(AbstractQuery query)
-
configureHistoricJobLogQuery
public void configureHistoricJobLogQuery(HistoricJobLogQueryImpl query)
-
configureHistoricIncidentQuery
public void configureHistoricIncidentQuery(HistoricIncidentQueryImpl query)
-
configureHistoricIdentityLinkQuery
public void configureHistoricIdentityLinkQuery(HistoricIdentityLinkLogQueryImpl query)
-
configureHistoricDecisionInstanceQuery
public void configureHistoricDecisionInstanceQuery(HistoricDecisionInstanceQueryImpl query)
-
configureHistoricExternalTaskLogQuery
public void configureHistoricExternalTaskLogQuery(HistoricExternalTaskLogQueryImpl query)
-
configureUserOperationLogQuery
public void configureUserOperationLogQuery(UserOperationLogQueryImpl query)
-
configureHistoricBatchQuery
public void configureHistoricBatchQuery(HistoricBatchQueryImpl query)
-
configureDeploymentStatisticsQuery
public void configureDeploymentStatisticsQuery(DeploymentStatisticsQueryImpl query)
-
configureProcessDefinitionStatisticsQuery
public void configureProcessDefinitionStatisticsQuery(ProcessDefinitionStatisticsQueryImpl query)
-
configureActivityStatisticsQuery
public void configureActivityStatisticsQuery(ActivityStatisticsQueryImpl query)
-
configureExternalTaskQuery
public void configureExternalTaskQuery(ExternalTaskQueryImpl query)
-
configureExternalTaskFetch
public void configureExternalTaskFetch(ListQueryParameterObject parameter)
-
configureDecisionDefinitionQuery
public void configureDecisionDefinitionQuery(DecisionDefinitionQueryImpl query)
-
configureDecisionRequirementsDefinitionQuery
public void configureDecisionRequirementsDefinitionQuery(DecisionRequirementsDefinitionQueryImpl query)
-
configureBatchQuery
public void configureBatchQuery(BatchQueryImpl query)
-
configureBatchStatisticsQuery
public void configureBatchStatisticsQuery(BatchStatisticsQueryImpl query)
-
filterAuthenticatedGroupIds
public java.util.List<java.lang.String> filterAuthenticatedGroupIds(java.util.List<java.lang.String> authenticatedGroupIds)
-
isAuthCheckExecuted
protected boolean isAuthCheckExecuted()
-
isEnsureSpecificVariablePermission
public boolean isEnsureSpecificVariablePermission()
-
isHistoricInstancePermissionsEnabled
protected boolean isHistoricInstancePermissionsEnabled()
-
addRemovalTimeToAuthorizationsByRootProcessInstanceId
public void addRemovalTimeToAuthorizationsByRootProcessInstanceId(java.lang.String rootProcessInstanceId, java.util.Date removalTime)
-
addRemovalTimeToAuthorizationsByProcessInstanceId
public void addRemovalTimeToAuthorizationsByProcessInstanceId(java.lang.String processInstanceId, java.util.Date removalTime)
-
deleteAuthorizationsByRemovalTime
public DbOperation deleteAuthorizationsByRemovalTime(java.util.Date removalTime, int minuteFrom, int minuteTo, int batchSize)
-
-