Class GlobalPermissionResource
java.lang.Object
com.atlassian.bamboo.plugins.testutils.rest.resource.administration.GlobalPermissionResource
@Path("permissions")
@Produces("application/json")
@Consumes("application/json")
public class GlobalPermissionResource
extends Object
REST endpoint to manage user/group permissions in bamboo.
-
Constructor Summary
ConstructorDescriptionGlobalPermissionResource
(BambooPermissionManager bambooPermissionManager, HibernateMutableAclService aclService, com.atlassian.sal.api.message.I18nResolver i18nResolver, BambooUserManager userManager, AdministrationConfigurationAccessor administrationConfigurationAccessor, AdministrationConfigurationPersister administrationConfigurationPersister, GlobalPermissionsService globalPermissionsService) -
Method Summary
Modifier and TypeMethodDescription@NotNull List<RestGlobalPermission>
getGroupPermission
(@Nullable String groupName, @NotNull ExpansionParam expansion, @NotNull javax.ws.rs.core.UriInfo uriInfo) Retrieve a list of groups with their permissions.@NotNull List<RestGlobalPermission>
getRolePermission
(@Nullable String roleName, @NotNull ExpansionParam expansion, @NotNull javax.ws.rs.core.UriInfo uriInfo) Retrieve a list of roles with their permissions.@NotNull List<RestGlobalPermission>
getUserPermission
(@Nullable String userName, @NotNull ExpansionParam expansion, @NotNull javax.ws.rs.core.UriInfo uriInfo) Retrieve a list of users with their permissions.@NotNull RestGlobalPermission
updateGroupPermission
(@Nullable RestGlobalPermission restGlobalPermission, @NotNull javax.ws.rs.core.UriInfo uriInfo) Update global permissions of a group.updateRolePermission
(@Nullable RestGlobalPermission restGlobalPermission, @NotNull javax.ws.rs.core.UriInfo uriInfo) Update global permissions of a role.@NotNull RestGlobalPermission
updateUserPermission
(@Nullable RestGlobalPermission restGlobalPermission, @NotNull javax.ws.rs.core.UriInfo uriInfo) Update global permissions of a user.
-
Constructor Details
-
GlobalPermissionResource
@Inject public GlobalPermissionResource(BambooPermissionManager bambooPermissionManager, HibernateMutableAclService aclService, com.atlassian.sal.api.message.I18nResolver i18nResolver, BambooUserManager userManager, AdministrationConfigurationAccessor administrationConfigurationAccessor, AdministrationConfigurationPersister administrationConfigurationPersister, GlobalPermissionsService globalPermissionsService)
-
-
Method Details
-
getUserPermission
@GET @Path("users") @NotNull public @NotNull List<RestGlobalPermission> getUserPermission(@QueryParam("name") @Nullable @Nullable String userName, @NotNull @BeanParam @NotNull ExpansionParam expansion, @NotNull @Context @NotNull javax.ws.rs.core.UriInfo uriInfo) throws WebValidationException Retrieve a list of users with their permissions. The list can be filtered by some attributes. Currently only user name (query parameter "name") is supported and is mandatory. Only one user will be included in the result.- Parameters:
userName
- user name- Returns:
- a list of user's permissions
- Throws:
WebValidationException
-
getGroupPermission
@GET @Path("groups") @NotNull public @NotNull List<RestGlobalPermission> getGroupPermission(@QueryParam("name") @Nullable @Nullable String groupName, @NotNull @BeanParam @NotNull ExpansionParam expansion, @NotNull @Context @NotNull javax.ws.rs.core.UriInfo uriInfo) throws WebValidationException Retrieve a list of groups with their permissions. The list can be filtered by some attributes. Currently Only group name is supported and is mandatory. Only one group will be included in the result. Group name is provided as a query parameter, e.g. http://bamboo/rest/backdoor/latest/permissions/roles?name=bamboo-admin- Parameters:
groupName
- Group name- Returns:
- A list of group permissions
- Throws:
WebValidationException
-
getRolePermission
@GET @Path("roles") @NotNull public @NotNull List<RestGlobalPermission> getRolePermission(@QueryParam("name") @Nullable @Nullable String roleName, @NotNull @BeanParam @NotNull ExpansionParam expansion, @NotNull @Context @NotNull javax.ws.rs.core.UriInfo uriInfo) throws WebValidationException Retrieve a list of roles with their permissions. The list can be filtered by some attributes. Currently Only role name is supported and is mandatory. Only one role will be included in the result. Only two roles are supported: ROLE_USER, the logged in user, and ROLE_ANONYMOUS, anonymous user. Role name is provided as a query parameter, e.g. http://bamboo/rest/backdoor/latest/permissions/roles?name=ROLE_USER- Parameters:
roleName
- name of the role- Returns:
- List of permissions
- Throws:
WebValidationException
-
updateUserPermission
@POST @Path("users") @NotNull public @NotNull RestGlobalPermission updateUserPermission(@Nullable @Nullable RestGlobalPermission restGlobalPermission, @NotNull @Context @NotNull javax.ws.rs.core.UriInfo uriInfo) throws WebValidationException Update global permissions of a user. Only Restricted/System Admins are allowed to invoke this REST endpoint. Restricted Admins cannot update any System Admin permissions. It also guarantees there's at lease one group or user has System Admin permission.- Parameters:
restGlobalPermission
- Permission model of the user- Returns:
- Updated permission model of the user
- Throws:
WebValidationException
-
updateGroupPermission
@POST @Path("groups") @NotNull public @NotNull RestGlobalPermission updateGroupPermission(@Nullable @Nullable RestGlobalPermission restGlobalPermission, @NotNull @Context @NotNull javax.ws.rs.core.UriInfo uriInfo) throws WebValidationException Update global permissions of a group. Only Restricted/System Admins are allowed to invoke this REST endpoint. Restricted Admins cannot update any System Admin permissions. It also guarantees there's at lease one group or user has System Admin permission.- Parameters:
restGlobalPermission
- Permission model of the group- Returns:
- Updated permission model of the group
- Throws:
WebValidationException
-
updateRolePermission
@POST @Path("roles") public RestGlobalPermission updateRolePermission(@Nullable @Nullable RestGlobalPermission restGlobalPermission, @NotNull @Context @NotNull javax.ws.rs.core.UriInfo uriInfo) throws WebValidationException Update global permissions of a role. Only Restricted/System Admins are allowed to invoke this REST endpoint. Only two roles are allowed to be updated: ROLE_USER, the logged in user, and ROLE_ANONYMOUS, anonymous user. Logged in users can only be granted READ, CREATE permission, anonymous users can only be granted READ permission.- Parameters:
restGlobalPermission
-uriInfo
-- Returns:
- Updated permission model of the role
- Throws:
WebValidationException
-