public class

PermissionRequest

extends Object
java.lang.Object
   ↳ com.atlassian.bitbucket.permission.PermissionRequest

Class Overview

Represents a permission request, which can be used to request users with a specific permission, or verify that users have a specific permission.

Note that this class does not validate the relationship between the permission and the resource that it holds. The APIs accepting instances of permission requests are responsible for verifying whether given permission request is valid.

Summary

Nested Classes
class PermissionRequest.Builder  
Protected Constructors
PermissionRequest(PermissionRequest.Builder builder)
Public Methods
@Nonnull Permission getPermission()
@Nullable Object getResource()
Resource to which the permission should apply.
@Nullable <T> T getResourceAs(Class<T> resourceType)
Resource to which the permission should apply, as a client-specified instance of resourceType.
@Nullable ApplicationUser getUser()
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected PermissionRequest (PermissionRequest.Builder builder)

Public Methods

@Nonnull public Permission getPermission ()

Returns
  • permission to satisfy the request, which can be either a global permission, or a resource permission to the specified resource

@Nullable public Object getResource ()

Resource to which the permission should apply. This could be a domain object (e.g. project or repository), as well as an ID.

Returns
  • resource to which the permission should apply, or null if this request does not concern any particular resource (which should be the case for global permissions)

@Nullable public T getResourceAs (Class<T> resourceType)

Resource to which the permission should apply, as a client-specified instance of resourceType.

Returns
  • resource to which the permission should apply, or null if this request does not concern any particular resource (which should be the case for global permissions)
Throws
ClassCastException if the resource is not an instance of the expected resourceType

@Nullable public ApplicationUser getUser ()

Returns
  • the user that should have the permission, or null if this request does not concern any particular user