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.


Method: Tuple2<Boolean,String> appInstall(String name, String description, String... perms)

Creates a permission set for this instance using the given name and current application key (appKey):

  • [appKey].[name]

For example O2C.approver

The given permissions (perms) are expressed as an array of name=value pairs

All parameters are mandatory

Returns true,"ok" if successful else false,"Error Message"

Note

This method can only be used from an application install script. The instance Integration requires the permsets=install permission to perform this function


Method: Tuple2<Boolean,String> appUninstall()

Remove all permissions sets previously created using the above appInstall() method for the current application (if not assigned to users)

Returns true,"ok" if successful else false,"Error Message"

Note

This method can only be used from an application uninstall script. The instance Integration requires the permsets=install permission to perform this function

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")

println p6.permissions.appInstall("approver", "Invoice Approver", "transactions=view", "transactions=allow('Work Items'('Assignee'='%USER.EMAIL%'))")

println p6.permissions.appUninstall()