org.camunda.bpm.engine.authorization.Authorization.getGroupId()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.camunda.bpm.engine.authorization.Authorization.getGroupId()方法的一些代码示例,展示了Authorization.getGroupId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Authorization.getGroupId()方法的具体详情如下:
包路径:org.camunda.bpm.engine.authorization.Authorization
类名称:Authorization
方法名:getGroupId

Authorization.getGroupId介绍

暂无

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testGetAuthorizationById() {
 Authorization authorization = MockProvider.createMockGlobalAuthorization();
 AuthorizationQuery authorizationQuery = mock(AuthorizationQuery.class);
 when(authorizationServiceMock.createAuthorizationQuery()).thenReturn(authorizationQuery);
 when(authorizationQuery.authorizationId(MockProvider.EXAMPLE_AUTHORIZATION_ID)).thenReturn(authorizationQuery);
 when(authorizationQuery.singleResult()).thenReturn(authorization);
 given()
   .pathParam("id", MockProvider.EXAMPLE_AUTHORIZATION_ID)
 .then().expect()
   .statusCode(Status.OK.getStatusCode()).contentType(ContentType.JSON)
   .body("id", equalTo(authorization.getId()))
   .body("type", equalTo(authorization.getAuthorizationType()))
   .body("permissions[0]", equalTo(Permissions.READ.getName()))
   .body("permissions[1]", equalTo(Permissions.UPDATE.getName()))
   .body("userId", equalTo(authorization.getUserId()))
   .body("groupId", equalTo(authorization.getGroupId()))
   .body("resourceType", equalTo(authorization.getResourceType()))
   .body("resourceId", equalTo(authorization.getResourceId()))
 .when()
   .get(AUTH_RESOURCE_PATH);
}

代码示例来源:origin: camunda/camunda-bpm-platform

public static AuthorizationDto fromAuthorization(Authorization dbAuthorization) {
 AuthorizationDto authorizationDto = new AuthorizationDto();
 authorizationDto.setId(dbAuthorization.getId());
 authorizationDto.setType(dbAuthorization.getAuthorizationType());
 Permission[] dbPermissions = getPermissions(dbAuthorization);
 authorizationDto.setPermissions(PermissionConverter.getNamesForPermissions(dbAuthorization, dbPermissions));
 authorizationDto.setUserId(dbAuthorization.getUserId());
 authorizationDto.setGroupId(dbAuthorization.getGroupId());
 authorizationDto.setResourceType(dbAuthorization.getResourceType());
 authorizationDto.setResourceId(dbAuthorization.getResourceId());
 return authorizationDto;
}

代码示例来源:origin: camunda/camunda-bpm-platform

public static AuthorizationDto fromAuthorization(Authorization dbAuthorization) {
 AuthorizationDto authorizationDto = new AuthorizationDto();
 authorizationDto.setId(dbAuthorization.getId());
 authorizationDto.setType(dbAuthorization.getAuthorizationType());
 Permission[] dbPermissions = getPermissions(dbAuthorization);
 authorizationDto.setPermissions(PermissionConverter.getNamesForPermissions(dbAuthorization, dbPermissions));
 authorizationDto.setUserId(dbAuthorization.getUserId());
 authorizationDto.setGroupId(dbAuthorization.getGroupId());
 authorizationDto.setResourceType(dbAuthorization.getResourceType());
 authorizationDto.setResourceId(dbAuthorization.getResourceId());
 return authorizationDto;
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testSimpleAuthorizationQuery() {
 List<Authorization> mockAuthorizations = MockProvider.createMockGlobalAuthorizations();
 AuthorizationQuery mockQuery = setUpMockQuery(mockAuthorizations);
 Response response = given().queryParam("type", Authorization.AUTH_TYPE_GLOBAL)
  .then().expect().statusCode(Status.OK.getStatusCode())
  .when().get(SERVICE_PATH);
 InOrder inOrder = inOrder(mockQuery);
 inOrder.verify(mockQuery).authorizationType(Authorization.AUTH_TYPE_GLOBAL);
 inOrder.verify(mockQuery).list();
 String content = response.asString();
 List<String> instances = from(content).getList("");
 Assert.assertEquals("There should be one authorization returned.", 1, instances.size());
 Assert.assertNotNull("The returned authorization should not be null.", instances.get(0));
 Authorization mockAuthorization = mockAuthorizations.get(0);
 Assert.assertEquals(mockAuthorization.getId(), from(content).getString("[0].id"));
 Assert.assertEquals(mockAuthorization.getAuthorizationType(), from(content).getInt("[0].type"));
 Assert.assertEquals(Permissions.READ.getName(), from(content).getString("[0].permissions[0]"));
 Assert.assertEquals(Permissions.UPDATE.getName(), from(content).getString("[0].permissions[1]"));
 Assert.assertEquals(mockAuthorization.getUserId(), from(content).getString("[0].userId"));
 Assert.assertEquals(mockAuthorization.getGroupId(), from(content).getString("[0].groupId"));
 Assert.assertEquals(mockAuthorization.getResourceType(), from(content).getInt("[0].resourceType"));
 Assert.assertEquals(mockAuthorization.getResourceId(), from(content).getString("[0].resourceId"));
}

代码示例来源:origin: org.camunda.bpm/camunda-engine-rest-jaxrs2

public static AuthorizationDto fromAuthorization(Authorization dbAuthorization) {
 AuthorizationDto authorizationDto = new AuthorizationDto();
 authorizationDto.setId(dbAuthorization.getId());
 authorizationDto.setType(dbAuthorization.getAuthorizationType());
 Permission[] dbPermissions = dbAuthorization.getPermissions(Permissions.values());
 authorizationDto.setPermissions(PermissionConverter.getNamesForPermissions(dbAuthorization, dbPermissions));
 authorizationDto.setUserId(dbAuthorization.getUserId());
 authorizationDto.setGroupId(dbAuthorization.getGroupId());
 authorizationDto.setResourceType(dbAuthorization.getResourceType());
 authorizationDto.setResourceId(dbAuthorization.getResourceId());
 return authorizationDto;
}

相关文章