本文整理汇总了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();
}
示例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());
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
};
}
示例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");
}
}
示例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());
}
示例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);
}
示例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;
}
示例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"));
}
示例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);
}
};
}