use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.
the class ApplicationRolesController method removeGroupRole.
/**
* Remove a role from a user on a specific application
*
* @param applicationId The id of the application.
* @param groupId The id of the group to update roles.
* @param role The role to add to the user on the application.
* @return A {@link Void} {@link RestResponse}.
*/
@ApiOperation(value = "Remove a role of a group on a specific application", notes = "Any user with application role APPLICATION_MANAGER can un-assign any role to a group. Application role required [ APPLICATION_MANAGER ]")
@RequestMapping(value = "/groups/{groupId}/{role}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
@Audit
public RestResponse<Void> removeGroupRole(@PathVariable String applicationId, @PathVariable String groupId, @PathVariable String role) {
Application application = applicationService.getOrFail(applicationId);
AuthorizationUtil.checkAuthorizationForApplication(application, ApplicationRole.APPLICATION_MANAGER);
resourceRoleService.removeGroupRole(application, groupId, role);
return RestResponseBuilder.<Void>builder().build();
}
use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.
the class ApplicationRolesController method addGroupRole.
/**
* Add a role to a group on a specific application
*
* @param applicationId The id of the application.
* @param groupId The id of the group to update roles.
* @param role The role to add to the group on the application.
* @return A {@link Void} {@link RestResponse}.
*/
@ApiOperation(value = "Add a role to a group on a specific application", notes = "Any user with application role APPLICATION_MANAGER can assign any role to a group of users. Application role required [ APPLICATION_MANAGER ]")
@RequestMapping(value = "/groups/{groupId}/{role}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
@Audit
public RestResponse<Void> addGroupRole(@PathVariable String applicationId, @PathVariable String groupId, @PathVariable String role) {
Application application = applicationService.getOrFail(applicationId);
AuthorizationUtil.checkAuthorizationForApplication(application, ApplicationRole.APPLICATION_MANAGER);
resourceRoleService.addGroupRole(application, groupId, role);
return RestResponseBuilder.<Void>builder().build();
}
use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.
the class ApplicationRolesController method removeUserRole.
/**
* Remove a role from a user on a specific application
*
* @param applicationId The id of the application.
* @param username The username of the user to update roles.
* @param role The role to add to the user on the application.
* @return A {@link Void} {@link RestResponse}.
*/
@ApiOperation(value = "Remove a role to a user on a specific application", notes = "Any user with application role APPLICATION_MANAGER can unassign any role to another user. Application role required [ APPLICATION_MANAGER ]")
@RequestMapping(value = "/users/{username}/{role}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
@Audit
public RestResponse<Void> removeUserRole(@PathVariable String applicationId, @PathVariable String username, @PathVariable String role) {
Application application = applicationService.getOrFail(applicationId);
AuthorizationUtil.checkAuthorizationForApplication(application, ApplicationRole.APPLICATION_MANAGER);
resourceRoleService.removeUserRole(application, username, role);
return RestResponseBuilder.<Void>builder().build();
}
use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.
the class ApplicationTagsController method deleteTag.
/**
* Delete a tag for the application.
*
* @param applicationId Id of the application for which to remove the tag.
* @param tagId The key of the tag to remove.
* @return An empty {@link RestResponse}.
*/
@ApiOperation(value = "Delete a tag for the application.", notes = "The logged-in user must have the application manager role for this application. Application role required [ APPLICATION_MANAGER ]")
@RequestMapping(value = "/{tagId}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
@Audit
public RestResponse<Void> deleteTag(@PathVariable String applicationId, @PathVariable String tagId) {
Application application = applicationService.getOrFail(applicationId);
AuthorizationUtil.checkAuthorizationForApplication(application, ApplicationRole.APPLICATION_MANAGER);
tagService.removeTag(application, tagId);
return RestResponseBuilder.<Void>builder().build();
}
use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.
the class ApplicationTagsController method upsertTag.
/**
* Update or create a tag for a given application
*
* @param applicationId The id of the application for which to update/create a tag.
* @param updateApplicationTagRequest The object that contains the tag's key and value.
* @return An empty rest response.
*/
@ApiOperation(value = "Update/Create a tag for the application.", notes = "The logged-in user must have the application manager role for this application. Application role required [ APPLICATION_MANAGER ]")
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
@Audit
public RestResponse<Void> upsertTag(@PathVariable String applicationId, @RequestBody UpdateTagRequest updateApplicationTagRequest) {
Application application = applicationService.getOrFail(applicationId);
AuthorizationUtil.checkAuthorizationForApplication(application, ApplicationRole.APPLICATION_MANAGER);
tagService.upsertTag(application, updateApplicationTagRequest.getTagKey(), updateApplicationTagRequest.getTagValue());
return RestResponseBuilder.<Void>builder().build();
}
Aggregations