Skip to content

Permissions

Purpose

A collection of methods to check permissions from a given permissions set

Methods

Binding name: p6.permissions


Method: boolean hasPermissions(String permissions, String feature, String action)

Checks if the action on the feature is allowed for the given permissions on the current instance.


Method: boolean hasPermissionsUsingPipelineRequest(String feature, String action)

Will retrieve the permissions from the pipeline reading the platform6.request.user.permissions entry and check if the action on the feature is allowed for the permissions on the current instance.


Method: boolean hasAnyPermissions(String permissions, List[String] actions)

Checks if the any of the actions is allowed for the given permissions on the current instance.


Method: boolean hasAnyPermissionsUsingPipelineRequest(List[String] actions)

Will retrieve the permissions from the pipeline reading the platform6.request.user.permissions entry and check if any action is allowed for the permissions on the current instance.

Examples

println p6.permissions.hasPermissions("instance:feature=action", "feature", "action")

println p6.permissions.hasAnyPermissions("instance:feature=action", "otherFeature=action", "feature=action")

println p6.permissions.hasPermissionsUsingPipelineRequest("scripts", "read")

println p6.permissions.hasAnyPermissionsUsingPipelineRequest("scripts=edit", "scripts=delete")