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


Java AuthorizationService.createNewAuthorization方法代码示例

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


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

示例1: instantiate

import org.camunda.bpm.engine.AuthorizationService; //导入方法依赖的package包/类
public Authorization instantiate(AuthorizationService authorizationService, Map<String, String> replacements) {
  Authorization authorization = authorizationService.createNewAuthorization(type);

  // TODO: group id is missing
  authorization.setResource(resource);

  if (replacements.containsKey(resourceId)) {
    authorization.setResourceId(replacements.get(resourceId));
  }
  else {
    authorization.setResourceId(resourceId);
  }
  authorization.setUserId(userId);
  authorization.setPermissions(permissions);

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

示例2: createAuthenticationData

import org.camunda.bpm.engine.AuthorizationService; //导入方法依赖的package包/类
private void createAuthenticationData() {
  IdentityService identityService = engineRule.getIdentityService();
  Group group = identityService.newGroup("group");
  identityService.saveGroup(group);
  User user = identityService.newUser("user");
  User user2 = identityService.newUser("user2");
  identityService.saveUser(user);
  identityService.saveUser(user2);
  Tenant tenant = identityService.newTenant("tenant");
  identityService.saveTenant(tenant);
  Tenant tenant2 = identityService.newTenant("tenant2");
  identityService.saveTenant(tenant2);
  identityService.createMembership("user", "group");
  identityService.createTenantUserMembership("tenant", "user");
  identityService.createTenantUserMembership("tenant2", "user2");


  TestResource resource1 = new TestResource("resource1", 100);
  // create global authorization which grants all permissions to all users (on resource1):
  AuthorizationService authorizationService = engineRule.getAuthorizationService();
  Authorization globalAuth = authorizationService.createNewAuthorization(AUTH_TYPE_GLOBAL);
  globalAuth.setResource(resource1);
  globalAuth.setResourceId(ANY);
  globalAuth.addPermission(ALL);
  authorizationService.saveAuthorization(globalAuth);

  //grant user read auth on resource2
  TestResource resource2 = new TestResource("resource2", 200);
  Authorization userGrant = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
  userGrant.setUserId("user");
  userGrant.setResource(resource2);
  userGrant.setResourceId(ANY);
  userGrant.addPermission(READ);
  authorizationService.saveAuthorization(userGrant);

  identityService.setAuthenticatedUserId("user");
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:38,代码来源:PurgeDatabaseTest.java

示例3: addAuthorizationGroup

import org.camunda.bpm.engine.AuthorizationService; //导入方法依赖的package包/类
private void addAuthorizationGroup(AuthorizationService authorizationService,
                                   Resource resource, String resourceId,
                                   String groupId, Permission[] permissions) {
    Authorization newAuthorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT);
    newAuthorization.setGroupId(groupId);
    newAuthorization.setResource(resource);
    newAuthorization.setResourceId(resourceId);
    for (Permission permission : permissions) {
        newAuthorization.addPermission(permission);
    }
    authorizationService.saveAuthorization(newAuthorization);
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:13,代码来源:ResourcesAuthorization.java

示例4: addAuthorizationUser

import org.camunda.bpm.engine.AuthorizationService; //导入方法依赖的package包/类
public void addAuthorizationUser(AuthorizationService authorizationService,
                                 Resource resource, String resourceId,
                                 String userId, Permission[] permissions) {
    Authorization newAuthorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT);
    newAuthorization.setUserId(userId);
    newAuthorization.setResource(resource);
    newAuthorization.setResourceId(resourceId);
    Arrays.stream(permissions).forEach(newAuthorization::addPermission);
    for (Permission permission : permissions) {
        newAuthorization.addPermission(permission);
    }
    authorizationService.saveAuthorization(newAuthorization);
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:14,代码来源:ResourcesAuthorization.java

示例5: grouptGrant

import org.camunda.bpm.engine.AuthorizationService; //导入方法依赖的package包/类
protected void grouptGrant(String groupId, Resource resource, Permission... perms) {

    AuthorizationService authorizationService = engine.getAuthorizationService();
    Authorization groupGrant = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
    groupGrant.setResource(resource);
    groupGrant.setResourceId(ANY);
    for (Permission permission : perms) {
      groupGrant.addPermission(permission);
    }
    groupGrant.setGroupId(groupId);
    authorizationService.saveAuthorization(groupGrant);
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:13,代码来源:AuthorizationPerformanceTestCase.java

示例6: userGrant

import org.camunda.bpm.engine.AuthorizationService; //导入方法依赖的package包/类
protected void userGrant(String userId, Resource resource, Permission... perms) {

    AuthorizationService authorizationService = engine.getAuthorizationService();
    Authorization groupGrant = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
    groupGrant.setResource(resource);
    groupGrant.setResourceId(ANY);
    for (Permission permission : perms) {
      groupGrant.addPermission(permission);
    }
    groupGrant.setUserId(userId);
    authorizationService.saveAuthorization(groupGrant);
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:13,代码来源:AuthorizationPerformanceTestCase.java

示例7: createAuthorization

import org.camunda.bpm.engine.AuthorizationService; //导入方法依赖的package包/类
protected static Authorization createAuthorization(AuthorizationService authorizationService, Permission permission, Resources resource, String userId) {
  Authorization auth = authorizationService.createNewAuthorization(AUTH_TYPE_GRANT);
  auth.addPermission(permission);
  auth.setResource(resource);
  auth.setResourceId(Authorization.ANY);
  auth.setUserId(userId);
  return auth;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:9,代码来源:AuthorizationScenario.java

示例8: createAuthorization

import org.camunda.bpm.engine.AuthorizationService; //导入方法依赖的package包/类
public AuthorizationDto createAuthorization(UriInfo context, AuthorizationCreateDto dto) {
  final AuthorizationService authorizationService = processEngine.getAuthorizationService();

  Authorization newAuthorization = authorizationService.createNewAuthorization(dto.getType());
  AuthorizationCreateDto.update(dto, newAuthorization);

  newAuthorization = authorizationService.saveAuthorization(newAuthorization);

  return getAuthorization(newAuthorization.getId()).getAuthorization(context);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:11,代码来源:AuthorizationRestServiceImpl.java


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