当前位置: 首页>>代码示例>>Java>>正文


Java ProcessEngine.getIdentityService方法代码示例

本文整理汇总了Java中org.camunda.bpm.engine.ProcessEngine.getIdentityService方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessEngine.getIdentityService方法的具体用法?Java ProcessEngine.getIdentityService怎么用?Java ProcessEngine.getIdentityService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.camunda.bpm.engine.ProcessEngine的用法示例。


在下文中一共展示了ProcessEngine.getIdentityService方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clean

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public void clean(ProcessEngine engine) {
	
	repositoryService = engine.getRepositoryService();
	runtimeService = engine.getRuntimeService();
	identityService = engine.getIdentityService();
	filterService = engine.getFilterService();
	authorizationService = engine.getAuthorizationService();

	// Delete all previous data in camunda
	cleanInstances();
	cleanMemberships();
	cleanUsers();
	cleanGroups();
	cleanFilters();
	cleanAuthorizations();
}
 
开发者ID:derursm,项目名称:bvis,代码行数:17,代码来源:CamundaCleaner.java

示例2: createUser

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
private void createUser(User user, Map<String, String> userPass, ProcessEngine processEngine) {
    IdentityService identityService = processEngine.getIdentityService();
    if (!userExist(user.getEmail(), identityService)) {

        String[] fio = user.getName().split(" ");

        org.camunda.bpm.engine.identity.User newUser = identityService.newUser(user.getEmail());

        newUser.setEmail(user.getEmail());
        newUser.setFirstName(fio[1]);
        newUser.setLastName(fio[0]);
        String password = userPass.get(user.getEmail());
        newUser.setPassword(isNotEmpty(password) ? password : UUID.randomUUID().toString());
        identityService.saveUser(newUser);

        identityService.createMembership(user.getEmail(), ALL_USERS);
        createViewFilter(processEngine, user.getEmail());
    }
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:20,代码来源:ResourcesAuthorization.java

示例3: resolveNotCachedLinks

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
protected List<HalResource<?>> resolveNotCachedLinks(String[] linkedIds, ProcessEngine processEngine) {
  IdentityService identityService = processEngine.getIdentityService();

  List<User> users = identityService.createUserQuery()
    .userIdIn(linkedIds)
    .listPage(0, linkedIds.length);

  List<HalResource<?>> resolvedUsers = new ArrayList<HalResource<?>>();
  for (User user : users) {
    resolvedUsers.add(HalUser.fromUser(user));
  }

  return resolvedUsers;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:HalUserResolver.java

示例4: resolveNotCachedLinks

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@Override
protected List<HalResource<?>> resolveNotCachedLinks(String[] linkedIds, ProcessEngine processEngine) {
  IdentityService identityService = processEngine.getIdentityService();

  List<Tenant> tenants = identityService
      .createTenantQuery()
      .tenantIdIn(linkedIds)
      .list();

  List<HalResource<?>> resolvedTenants = new ArrayList<HalResource<?>>();
  for (Tenant tenant : tenants) {
    resolvedTenants.add(HalTenant.fromTenant(tenant));
  }

  return resolvedTenants;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:HalTenantResolver.java

示例5: getApplicationPathForDeployment

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public static String getApplicationPathForDeployment(ProcessEngine engine, String deploymentId) {

    // get the name of the process application that made the deployment
    String processApplicationName = null;
    IdentityService identityService = engine.getIdentityService();
    Authentication currentAuthentication = identityService.getCurrentAuthentication();
    try {
      identityService.clearAuthentication();
      processApplicationName = engine.getManagementService().getProcessApplicationForDeployment(deploymentId);
    } finally {
      identityService.setAuthentication(currentAuthentication);
    }

    if (processApplicationName == null) {
      // no a process application deployment
      return null;
    } else {
      ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
      ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(processApplicationName);
      return processApplicationInfo.getProperties().get(ProcessApplicationInfo.PROP_SERVLET_CONTEXT_PATH);
    }
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:ApplicationContextPathUtil.java

示例6: startProcessInstance

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@DescribesScenario("startProcessInstance")
public static ScenarioSetup startProcessInstance() {
  return new ScenarioSetup() {
    public void execute(ProcessEngine engine, String scenarioName) {
      IdentityService identityService = engine.getIdentityService();

      // 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.getRuntimeService().startProcessInstanceByKey("oneTaskProcess", scenarioName);
    }
  };
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:AuthorizationScenario.java

示例7: initUser

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@DescribesScenario("initUser")
@Times(1)
public static ScenarioSetup initUser() {
  return new ScenarioSetup() {
    public void execute(ProcessEngine engine, String scenarioName) {
      // given
      IdentityService identityService = engine.getIdentityService();
      User user = identityService.newUser(USER_NAME);
      user.setPassword(USER_PWD);

      // when
      identityService.saveUser(user);

    }
  };
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:DeployUserWithoutSaltForPasswordHashingScenario.java

示例8: initDb

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public void initDb() {
    ProcessEngine processEngine = lookupProcessEngine(ENGINE_NAME);
    if (processEngine != null) {
        IdentityService identityService = processEngine.getIdentityService();
        AuthorizationService authorizationService = processEngine.getAuthorizationService();
        // the group must be created at the first start of the application
        if (identityService.createGroupQuery().groupId(ALL_USERS).list().size() == 0) {

            Group group = identityService.newGroup(ALL_USERS);
            group.setName(ALL_USERS);
            identityService.saveGroup(group);

            // set Auth for new group
            addAuthorizationGroup(authorizationService, Resources.APPLICATION, "tasklist", ALL_USERS, new Permission[] {Permissions.ACCESS});
            addAuthorizationGroup(authorizationService, Resources.USER, Authorization.ANY, ALL_USERS, new Permission[] {Permissions.READ});
            addAuthorizationGroup(authorizationService, Resources.PROCESS_DEFINITION, "TechOrder", ALL_USERS, new Permission[] {Permissions.READ,
                    Permissions.CREATE_INSTANCE, Permissions.READ_HISTORY});
            addAuthorizationGroup(authorizationService, Resources.PROCESS_INSTANCE, Authorization.ANY, ALL_USERS, new Permission[] {Permissions.CREATE});
            createDefaultFilter(processEngine);
        }

        // create users
        Set<User> users = orgStructure.getUsers();
        Map<String, String> userPass = orgStructure.getUserPass(users);
        users.stream().filter(user -> !userExist(user.getEmail(), identityService)).forEach(user -> createUser(user, userPass, processEngine));

    } else {
        throw new RuntimeException("Unable to init db");
    }
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:31,代码来源:ResourcesAuthorization.java

示例9: deleteUser

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
private void deleteUser(User user, ProcessEngine processEngine) {
    deleteViewFilter(user.getEmail(), processEngine);
    IdentityService identityService = processEngine.getIdentityService();
    List<Group> userGroups = identityService.createGroupQuery().groupMember(user.getEmail()).list();
    userGroups.forEach(group -> identityService.deleteMembership(user.getEmail(), group.getId()));
    identityService.deleteUser(user.getEmail());
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:8,代码来源:ResourcesAuthorization.java

示例10: postProcessEngineBuild

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@Override
public void postProcessEngineBuild(final ProcessEngine processEngine) {
  requireNonNull(adminUser);

  final IdentityService identityService = processEngine.getIdentityService();
  final AuthorizationService authorizationService = processEngine.getAuthorizationService();

  if (userAlreadyExists(identityService, adminUser)) {
    return;
  }

  createUser(identityService, adminUser);

  // create group
  if (identityService.createGroupQuery().groupId(CAMUNDA_ADMIN).count() == 0) {
    Group camundaAdminGroup = identityService.newGroup(CAMUNDA_ADMIN);
    camundaAdminGroup.setName("camunda BPM Administrators");
    camundaAdminGroup.setType(Groups.GROUP_TYPE_SYSTEM);
    identityService.saveGroup(camundaAdminGroup);
  }

  // create ADMIN authorizations on all built-in resources
  for (Resource resource : Resources.values()) {
    if (authorizationService.createAuthorizationQuery().groupIdIn(CAMUNDA_ADMIN).resourceType(resource).resourceId(ANY).count() == 0) {
      AuthorizationEntity userAdminAuth = new AuthorizationEntity(AUTH_TYPE_GRANT);
      userAdminAuth.setGroupId(CAMUNDA_ADMIN);
      userAdminAuth.setResource(resource);
      userAdminAuth.setResourceId(ANY);
      userAdminAuth.addPermission(ALL);
      authorizationService.saveAuthorization(userAdminAuth);
    }
  }

  identityService.createMembership(adminUser.getId(), CAMUNDA_ADMIN);
  LOG.creatingInitialAdminUser(adminUser);
}
 
开发者ID:camunda,项目名称:camunda-bpm-spring-boot-starter,代码行数:37,代码来源:CreateAdminUserConfiguration.java

示例11: resolveNotCachedLinks

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
protected List<HalResource<?>> resolveNotCachedLinks(String[] linkedIds, ProcessEngine processEngine) {
  IdentityService identityService = processEngine.getIdentityService();

  List<Group> groups = identityService.createGroupQuery()
    .groupIdIn(linkedIds)
    .listPage(0, linkedIds.length);

  List<HalResource<?>> resolvedGroups = new ArrayList<HalResource<?>>();
  for (Group group : groups) {
    resolvedGroups.add(HalGroup.fromGroup(group));
  }

  return resolvedGroups;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:HalGroupResolver.java

示例12: setUp

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@Before
public void setUp() {
  ProcessEngine processEngine = rule.getProcessEngine();

  identityService = processEngine.getIdentityService();
  repositoryService = processEngine.getRepositoryService();
  runtimeService = processEngine.getRuntimeService();
  taskService = processEngine.getTaskService();
  historyService = processEngine.getHistoryService();
  formService = processEngine.getFormService();

  identityService.clearAuthentication();
  identityService.setAuthentication("test", Arrays.asList("accounting"));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:AuthorizationTest.java

示例13: startProcessInstance

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@DescribesScenario("startProcessInstance")
@Times(1)
public static ScenarioSetup startProcessInstance() {
  return new ScenarioSetup() {
    public void execute(ProcessEngine engine, String scenarioName) {
      IdentityService identityService = engine.getIdentityService();

      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.getAuthorizationService();

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

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

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

      // start a process instance
      engine.getRuntimeService().startProcessInstanceByKey(PROCESS_DEF_KEY, scenarioName);
    }
  };
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:41,代码来源:AuthorizationScenario.java


注:本文中的org.camunda.bpm.engine.ProcessEngine.getIdentityService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。