Class GlobalPermissionControl
java.lang.Object
com.atlassian.bamboo.testutils.backdoor.BackdoorControl<GlobalPermissionControl>
com.atlassian.bamboo.testutils.backdoor.GlobalPermissionControl
Provides a way to deal with global permissions, for testing purposes.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.atlassian.bamboo.testutils.backdoor.BackdoorControl
BackdoorControl.AddXsrfNoCheckTokenFilter, BackdoorControl.JsonMediaTypeFilter
-
Field Summary
Fields inherited from class com.atlassian.bamboo.testutils.backdoor.BackdoorControl
ADMIN_REST_PATH, API_REST_PATH, DEFAULT_REST_PATH, XSRF_NO_CHECK, XSRF_TOKEN_HEADER
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected javax.ws.rs.client.WebTarget
Creates the resource that corresponds to the root of the TestKit REST API, using the values returned byBackdoorControl.getRestModulePath()
.@NotNull List<BambooPermission>
getGroupPermissions
(@NotNull TestGroup group) Get current global group permissions.@NotNull List<BambooPermission>
getRolePermissions
(@NotNull BambooRole role) Get current global role permissions.@NotNull List<BambooPermission>
getUserPermissions
(@NotNull TestUser user) Get current global user permissions.void
setAnonymousAccess
(boolean isEnabled) Updates the Anonymous Access global permission in the Bamboo instance.void
setGroupPermissions
(@NotNull TestGroup testGroup, @NotNull Collection<BambooPermission> permissions) Set global permissions for a user group.void
setLoggedUserPermission
(BambooPermission... permissions) Updates the Logged in users global permissions in the Bamboo instance.void
setLoggedUserPermission
(Collection<BambooPermission> permissions) Updates the Logged in users global permissions in the Bamboo instance.void
setLoggedUserPermission
(Stream<BambooPermission> permissions) Updates the Logged in users global permissions in the Bamboo instance.void
setRolePermissions
(@NotNull BambooRole role, @NotNull Collection<BambooPermission> permissions) Set global role permissions.void
setUserPermissions
(@NotNull TestUser testUser, @NotNull Collection<BambooPermission> permissions) Set global permissions for a user.void
tearDown()
Cleanup resourcesMethods inherited from class com.atlassian.bamboo.testutils.backdoor.BackdoorControl
anonymousResourceRoot, client, createResourceForPath, createResourceForPath, get, getEnvironmentData, getRestModulePath, getRootPath, percentEncode, ping, post, resourceRoot
-
Constructor Details
-
GlobalPermissionControl
-
-
Method Details
-
tearDown
public void tearDown()Description copied from class:BackdoorControl
Cleanup resources- Overrides:
tearDown
in classBackdoorControl<GlobalPermissionControl>
-
setAnonymousAccess
public void setAnonymousAccess(boolean isEnabled) Updates the Anonymous Access global permission in the Bamboo instance.- Parameters:
isEnabled
- true if anonymous access is to be allowed, false otherwise
-
getUserPermissions
@NotNull public @NotNull List<BambooPermission> getUserPermissions(@NotNull @NotNull TestUser user) throws Exception Get current global user permissions.- Throws:
Exception
-
setUserPermissions
public void setUserPermissions(@NotNull @NotNull TestUser testUser, @NotNull @NotNull Collection<BambooPermission> permissions) throws Exception Set global permissions for a user. This method can be used to revoke permissions.- Throws:
Exception
-
setLoggedUserPermission
Updates the Logged in users global permissions in the Bamboo instance.- Parameters:
permissions
- list of permissions to be granted
-
setLoggedUserPermission
Updates the Logged in users global permissions in the Bamboo instance.- Parameters:
permissions
- list of permissions to be granted
-
setLoggedUserPermission
Updates the Logged in users global permissions in the Bamboo instance. -
getGroupPermissions
@NotNull public @NotNull List<BambooPermission> getGroupPermissions(@NotNull @NotNull TestGroup group) throws Exception Get current global group permissions.- Throws:
Exception
-
setGroupPermissions
public void setGroupPermissions(@NotNull @NotNull TestGroup testGroup, @NotNull @NotNull Collection<BambooPermission> permissions) throws Exception Set global permissions for a user group. This method can be used to revoke permissions.- Throws:
Exception
-
getRolePermissions
@NotNull public @NotNull List<BambooPermission> getRolePermissions(@NotNull @NotNull BambooRole role) Get current global role permissions. -
setRolePermissions
public void setRolePermissions(@NotNull @NotNull BambooRole role, @NotNull @NotNull Collection<BambooPermission> permissions) Set global role permissions. This method can be used to revoke permissions. -
createResource
protected javax.ws.rs.client.WebTarget createResource()Description copied from class:BackdoorControl
Creates the resource that corresponds to the root of the TestKit REST API, using the values returned byBackdoorControl.getRestModulePath()
. Note that the createdWebResource
has the following properties:- it logs all GET/POST/etc requests made through it
- it sets the
Content-Type: application/json
by default (override withWebTarget.request(MediaType...)
)
BackdoorControl.createResourceForPath(java.lang.String)
- Overrides:
createResource
in classBackdoorControl<GlobalPermissionControl>
- Returns:
- a WebResource for the TestKit REST API root
- See Also:
-