Class GlobalPermissionControl
- java.lang.Object
-
- com.atlassian.bamboo.testutils.backdoor.BackdoorControl<GlobalPermissionControl>
-
- com.atlassian.bamboo.testutils.backdoor.GlobalPermissionControl
-
public class GlobalPermissionControl extends BackdoorControl<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, rootPath
-
-
Constructor Summary
Constructors Constructor Description GlobalPermissionControl(@NotNull BambooEnvironmentData environmentData)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.sun.jersey.api.client.WebResourcecreateResource()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.voidsetAnonymousAccess(boolean isEnabled)Updates the Anonymous Access global permission in the Bamboo instance.voidsetGroupPermissions(@NotNull TestGroup testGroup, @NotNull Collection<BambooPermission> permissions)Set global permissions for a user group.voidsetLoggedUserPermission(BambooPermission... permissions)Updates the Logged in users global permissions in the Bamboo instance.voidsetLoggedUserPermission(Collection<BambooPermission> permissions)Updates the Logged in users global permissions in the Bamboo instance.voidsetLoggedUserPermission(Stream<BambooPermission> permissions)Updates the Logged in users global permissions in the Bamboo instance.voidsetRolePermissions(@NotNull BambooRole role, @NotNull Collection<BambooPermission> permissions)Set global role permissions.voidsetUserPermissions(@NotNull TestUser testUser, @NotNull Collection<BambooPermission> permissions)Set global permissions for a user.voidtearDown()Cleanup resources-
Methods inherited from class com.atlassian.bamboo.testutils.backdoor.BackdoorControl
client, createResourceForPath, get, getEnvironmentData, getRestModulePath, percentEncode, ping, post, resourceRoot
-
-
-
-
Constructor Detail
-
GlobalPermissionControl
public GlobalPermissionControl(@NotNull @NotNull BambooEnvironmentData environmentData)
-
-
Method Detail
-
tearDown
public void tearDown()
Description copied from class:BackdoorControlCleanup resources- Overrides:
tearDownin 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 ExceptionSet global permissions for a user. This method can be used to revoke permissions.- Throws:
Exception
-
setLoggedUserPermission
public void setLoggedUserPermission(Collection<BambooPermission> permissions)
Updates the Logged in users global permissions in the Bamboo instance.- Parameters:
permissions- list of permissions to be granted
-
setLoggedUserPermission
public void setLoggedUserPermission(BambooPermission... permissions)
Updates the Logged in users global permissions in the Bamboo instance.- Parameters:
permissions- list of permissions to be granted
-
setLoggedUserPermission
public void setLoggedUserPermission(Stream<BambooPermission> permissions)
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 ExceptionSet 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 com.sun.jersey.api.client.WebResource createResource()
Description copied from class:BackdoorControlCreates the resource that corresponds to the root of the TestKit REST API, using the values returned byBackdoorControl.getRestModulePath(). Note that the createdWebResourcehas the following properties:- it logs all GET/POST/etc requests made through it
- it sets the
Content-Type: application/jsonby default (override withWebResource.type(javax.ws.rs.core.MediaType))
BackdoorControl.createResourceForPath(java.lang.String)- Overrides:
createResourcein classBackdoorControl<GlobalPermissionControl>- Returns:
- a WebResource for the TestKit REST API root
- See Also:
BackdoorControl.createResource(),BackdoorControl.getRestModulePath()
-
-