Example #1
0
        // group //////////////////////////////////////////////////////////////

        protected internal virtual Group createGroup(IdentityService identityService, string groupId)
        {
            Group group = identityService.newGroup(groupId);

            identityService.saveGroup(group);
            return(group);
        }
Example #2
0
            public void execute(ProcessEngine engine, string scenarioName)
            {
                IdentityService identityService = engine.IdentityService;

                string userId  = USER_ID + scenarioName;
                string groupid = GROUP_ID + scenarioName;
                // create an user
                User user = identityService.newUser(userId);

                identityService.saveUser(user);

                // create group
                Group group = identityService.newGroup(groupid);

                identityService.saveGroup(group);

                // create membership
                identityService.createMembership(userId, groupid);

                //create full authorization
                AuthorizationService authorizationService = engine.AuthorizationService;

                //authorization for process definition
                Authorization authProcDef = createAuthorization(authorizationService, Permissions.ALL, Resources.PROCESS_DEFINITION, userId);

                engine.AuthorizationService.saveAuthorization(authProcDef);

                //authorization for deployment
                Authorization authDeployment = createAuthorization(authorizationService, Permissions.ALL, Resources.DEPLOYMENT, userId);

                engine.AuthorizationService.saveAuthorization(authDeployment);

                //authorization for process instance create
                Authorization authProcessInstance = createAuthorization(authorizationService, Permissions.CREATE, Resources.PROCESS_INSTANCE, userId);

                engine.AuthorizationService.saveAuthorization(authProcessInstance);

                // start a process instance
                engine.RuntimeService.startProcessInstanceByKey(PROCESS_DEF_KEY, scenarioName);
            }
Example #3
0
            public void execute(ProcessEngine engine, string scenarioName)
            {
                IdentityService identityService = engine.IdentityService;

                // create an user
                string userId = "test";
                User   user   = identityService.newUser(userId);

                identityService.saveUser(user);

                // create group
                string groupId = "accounting";
                Group  group   = identityService.newGroup(groupId);

                identityService.saveGroup(group);

                // create membership
                identityService.createMembership("test", "accounting");

                // start a process instance
                engine.RuntimeService.startProcessInstanceByKey("oneTaskProcess", scenarioName);
            }