示例#1
0
        protected internal virtual bool isAuthorized(Permission permission, Resource resource, string resourceId)
        {
            if (!processEngine.ProcessEngineConfiguration.AuthorizationEnabled)
            {
                // if authorization is disabled everyone is authorized
                return(true);
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.IdentityService identityService = processEngine.getIdentityService();
            IdentityService identityService = processEngine.IdentityService;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.AuthorizationService authorizationService = processEngine.getAuthorizationService();
            AuthorizationService authorizationService = processEngine.AuthorizationService;

            Authentication authentication = identityService.CurrentAuthentication;

            if (authentication == null)
            {
                return(true);
            }
            else
            {
                return(authorizationService.isUserAuthorized(authentication.UserId, authentication.GroupIds, permission, resource, resourceId));
            }
        }
示例#2
0
        // authorization ///////////////////////////////////////////////////////

        protected internal virtual void createGrantAuthorization(Resource resource, string resourceId, Permission permission, string userId)
        {
            Authorization authorization = createGrantAuthorization(resource, resourceId);

            authorization.UserId = userId;
            authorization.addPermission(permission);
            saveAuthorization(authorization);
        }
示例#3
0
        protected internal static Authorization createAuthorization(AuthorizationService authorizationService, Permission permission, Resources resource, string userId)
        {
            Authorization auth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);

            auth.addPermission(permission);
            auth.Resource   = resource;
            auth.ResourceId = org.camunda.bpm.engine.authorization.Authorization_Fields.ANY;
            auth.UserId     = userId;
            return(auth);
        }
示例#4
0
 protected internal virtual void checkAuthorizations(CommandContext commandContext, Permission permission)
 {
     foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
     {
         checker.checkCreateBatch(permission);
     }
 }
示例#5
0
 protected internal virtual bool isAuthorized(Permission permission)
 {
     return(isAuthorized(permission, resource));
 }
示例#6
0
 public virtual void checkCreateBatch(Permission permission)
 {
 }