Package org.jbpm.casemgmt.impl
Class AuthorizationManagerImpl
- java.lang.Object
-
- org.jbpm.casemgmt.impl.AuthorizationManagerImpl
-
- All Implemented Interfaces:
AuthorizationManager
public class AuthorizationManagerImpl extends Object implements AuthorizationManager
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jbpm.casemgmt.api.auth.AuthorizationManager
AuthorizationManager.ProtectedOperation
-
-
Field Summary
-
Fields inherited from interface org.jbpm.casemgmt.api.auth.AuthorizationManager
ADMIN_ROLE, OWNER_ROLE, PUBLIC_GROUP, UNKNOWN_USER
-
-
Constructor Summary
Constructors Constructor Description AuthorizationManagerImpl(org.kie.internal.identity.IdentityProvider identityProvider, TransactionalCommandService commandService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuildAuthorizationConfig()voidcheckAuthorization(String caseId)Checks if the caller (based on identity provider) is authorized to work with a case identified by caseIdvoidcheckCommentAuthorization(String caseId, CaseFileInstance caseFileInstance, CommentInstance commentInstance)Check if caller (based on identity provider) is authorized to manipulate given commentvoidcheckDataAuthorization(String caseId, CaseFileInstance caseFileInstance, Collection<String> dataNames)Check if caller (based on identity provider) is authorized to manipulate given datavoidcheckOperationAuthorization(String caseId, AuthorizationManager.ProtectedOperation operation)Checks if the caller (based on identity provider) is authorized to perform given operation on a case.protected List<String>collectUserAuthInfo()List<CommentInstance>filterByCommentAuthorization(String caseId, CaseFileInstance caseFileInstance, List<CommentInstance> comments)Filters provided comments by their restrictions.Map<String,Object>filterByDataAuthorization(String caseId, CaseFileInstance caseFileInstance, Map<String,Object> data)Filters provided data by data restrictions.protected List<String>getCallerRoles(CaseFileInstance caseFileInstance, List<String> callerAuthorization)booleanisEnabled()protected booleanloggedInAsSystemUser()voidsetEnabled(boolean enabled)protected voidverifyAuthorization(String caseId, List<String> authorizedEntities, String errorMessage)
-
-
-
Constructor Detail
-
AuthorizationManagerImpl
public AuthorizationManagerImpl(org.kie.internal.identity.IdentityProvider identityProvider, TransactionalCommandService commandService)
-
-
Method Detail
-
checkAuthorization
public void checkAuthorization(String caseId) throws SecurityException
Description copied from interface:AuthorizationManagerChecks if the caller (based on identity provider) is authorized to work with a case identified by caseId- Specified by:
checkAuthorizationin interfaceAuthorizationManager- Parameters:
caseId- unique id of the case- Throws:
SecurityException- thrown when caller is not authorized to access the case instance
-
checkOperationAuthorization
public void checkOperationAuthorization(String caseId, AuthorizationManager.ProtectedOperation operation) throws SecurityException
Description copied from interface:AuthorizationManagerChecks if the caller (based on identity provider) is authorized to perform given operation on a case.- Specified by:
checkOperationAuthorizationin interfaceAuthorizationManager- Parameters:
caseId- unique id of the caseoperation- operations that is being invoked- Throws:
SecurityException- thrown when caller is not authorized to access the case instance
-
isEnabled
public boolean isEnabled()
-
setEnabled
public void setEnabled(boolean enabled)
-
buildAuthorizationConfig
protected void buildAuthorizationConfig()
-
verifyAuthorization
protected void verifyAuthorization(String caseId, List<String> authorizedEntities, String errorMessage)
-
filterByDataAuthorization
public Map<String,Object> filterByDataAuthorization(String caseId, CaseFileInstance caseFileInstance, Map<String,Object> data)
Description copied from interface:AuthorizationManagerFilters provided data by data restrictions. This guarantees only data authorized for given user will be returned.- Specified by:
filterByDataAuthorizationin interfaceAuthorizationManager- Parameters:
caseId- unique id of the casecaseFileInstance- case file associated with given case instancedata- actual data to be filtered- Returns:
- returns filtered map of data if any restriction applied
-
checkDataAuthorization
public void checkDataAuthorization(String caseId, CaseFileInstance caseFileInstance, Collection<String> dataNames)
Description copied from interface:AuthorizationManagerCheck if caller (based on identity provider) is authorized to manipulate given data- Specified by:
checkDataAuthorizationin interfaceAuthorizationManager- Parameters:
caseId- unique id of the casecaseFileInstance- case file associated with given case instancedataNames- data names to be manipulated/put into the case instance
-
filterByCommentAuthorization
public List<CommentInstance> filterByCommentAuthorization(String caseId, CaseFileInstance caseFileInstance, List<CommentInstance> comments)
Description copied from interface:AuthorizationManagerFilters provided comments by their restrictions. This guarantees only comments authorized to be seen by user will be returned.- Specified by:
filterByCommentAuthorizationin interfaceAuthorizationManager- Parameters:
caseId- unique id of the casecaseFileInstance- case file associated with given case instancecomments- comments to be filtered- Returns:
- filtered comments if any restrictions applied or same as given as argument
-
checkCommentAuthorization
public void checkCommentAuthorization(String caseId, CaseFileInstance caseFileInstance, CommentInstance commentInstance)
Description copied from interface:AuthorizationManagerCheck if caller (based on identity provider) is authorized to manipulate given comment- Specified by:
checkCommentAuthorizationin interfaceAuthorizationManager- Parameters:
caseId- unique id of the casecaseFileInstance- case file associated with given case instancecommentInstance- comment that is about to be manipulated (updated or removed)
-
getCallerRoles
protected List<String> getCallerRoles(CaseFileInstance caseFileInstance, List<String> callerAuthorization)
-
loggedInAsSystemUser
protected boolean loggedInAsSystemUser()
-
-