Class PermissionRequest
java.lang.Object
com.atlassian.bitbucket.permission.PermissionRequest
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.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionResource to which thepermission
should apply.<T> T
getResourceAs
(Class<T> resourceType) Resource to which thepermission
should apply, as a client-specified instance ofresourceType
.getUser()
-
Constructor Details
-
PermissionRequest
-
-
Method Details
-
getPermission
- Returns:
- permission to satisfy the request, which can be either a
global permission
, or a resource permission to the specifiedresource
-
getResource
Resource to which thepermission
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, ornull
if this request does not concern any particular resource (which should be the case forglobal permissions
)
-
getResourceAs
Resource to which thepermission
should apply, as a client-specified instance ofresourceType
.- Type Parameters:
T
- resource type- Parameters:
resourceType
- the type of the resource to cast to- Returns:
- resource to which the
permission
should apply, ornull
if this request does not concern any particular resource (which should be the case forglobal permissions
) - Throws:
ClassCastException
- if the resource is not an instance of the expectedresourceType
-
getUser
- Returns:
- the user that should have the
permission
, ornull
if this request does not concern any particular user
-