use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class AuthorizationRestServiceImpl method queryAuthorizations.
public List<AuthorizationDto> queryAuthorizations(AuthorizationQueryDto queryDto, Integer firstResult, Integer maxResults) {
queryDto.setObjectMapper(getObjectMapper());
AuthorizationQuery query = queryDto.toQuery(getProcessEngine());
List<Authorization> resultList;
if (firstResult != null || maxResults != null) {
resultList = executePaginatedQuery(query, firstResult, maxResults);
} else {
resultList = query.list();
}
return AuthorizationDto.fromAuthorizationList(resultList);
}
use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class AuthorizationRestServiceImpl method createAuthorization.
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);
}
use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class AuthorizationRestServiceQueryTest method testCompleteGetParameters.
@Test
public void testCompleteGetParameters() {
List<Authorization> mockAuthorizations = MockProvider.createMockGlobalAuthorizations();
AuthorizationQuery mockQuery = setUpMockQuery(mockAuthorizations);
Map<String, String> queryParameters = getCompleteStringQueryParameters();
RequestSpecification requestSpecification = given().contentType(POST_JSON_CONTENT_TYPE);
for (Entry<String, String> paramEntry : queryParameters.entrySet()) {
requestSpecification.parameter(paramEntry.getKey(), paramEntry.getValue());
}
requestSpecification.expect().statusCode(Status.OK.getStatusCode()).when().get(SERVICE_PATH);
verify(mockQuery).authorizationId(MockProvider.EXAMPLE_AUTHORIZATION_ID);
verify(mockQuery).authorizationType(MockProvider.EXAMPLE_AUTHORIZATION_TYPE);
verify(mockQuery).userIdIn(new String[] { MockProvider.EXAMPLE_USER_ID, MockProvider.EXAMPLE_USER_ID2 });
verify(mockQuery).groupIdIn(new String[] { MockProvider.EXAMPLE_GROUP_ID, MockProvider.EXAMPLE_GROUP_ID2 });
verify(mockQuery).resourceType(MockProvider.EXAMPLE_RESOURCE_TYPE_ID);
verify(mockQuery).resourceId(MockProvider.EXAMPLE_RESOURCE_ID);
verify(mockQuery).list();
}
use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class AuthorizationResourceImpl method deleteAuthorization.
public void deleteAuthorization() {
Authorization dbAuthorization = getDbAuthorization();
authorizationService.deleteAuthorization(dbAuthorization.getId());
}
use of org.camunda.bpm.engine.authorization.Authorization in project camunda-bpm-platform by camunda.
the class AuthorizationResourceImpl method updateAuthorization.
public void updateAuthorization(AuthorizationDto dto) {
// get db auth
Authorization dbAuthorization = getDbAuthorization();
// copy values from dto
AuthorizationDto.update(dto, dbAuthorization);
// save
authorizationService.saveAuthorization(dbAuthorization);
}
Aggregations