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.WebResource
createResource()
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 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: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
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 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 com.sun.jersey.api.client.WebResource 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 withWebResource.type(javax.ws.rs.core.MediaType)
)
BackdoorControl.createResourceForPath(java.lang.String)
- Overrides:
createResource
in classBackdoorControl<GlobalPermissionControl>
- Returns:
- a WebResource for the TestKit REST API root
- See Also:
BackdoorControl.createResource()
,BackdoorControl.getRestModulePath()
-
-