AuthorizationPolicy

An authorization policy that defines the permissions for a principal to perform actions on several types of resources.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
Link copied to clipboard
fun <Resource : Any> allowed(principal: Principal, resource: Resource, vararg actions: ResourceAction<Resource>): Boolean

Returns a boolean indicating whether the principal is allowed all of the specified actions against the resource. Use this method when you wish to perform a permission check and handle a boolean value rather than an exception.

Link copied to clipboard
fun <Resource : Any> check(checkPermissions: PermissionsCheck<Principal, Resource>.() -> Unit)

Utility for defining a block of permission checks.

fun <Resource : Any> check(principal: Principal, resource: Resource, vararg actions: ResourceAction<Resource>)

Checks that the action performed by the principal is allowed against the resource. Throws a PermissionDeniedException when the action is not allowed. Use this method when you wish to perform a permission check that throws an exception.

Link copied to clipboard
inline fun <Resource : Any> resource(resourcePolicy: ResourcePolicy<Principal, Resource>)

Adds a policy for the specified resource type.

inline fun <Resource : Any> resource(init: ResourcePolicy<Principal, Resource>.() -> Unit)

Adds a policy for the specified resource type, initialized via the init block.