userCanAccessForm()

Overview

public boolean function userCanAccessForm(
      required string  formName                
    ,          string  permissionContext        = ""
    ,          array   permissionContextKeys   
    ,          boolean allowedIfNoPermissionKey = true
)

Returns whether or not the currently logged in admin user has permission to access the given form, based on the optional permissionKey attribute declared on the root form element of the form's definition. Forms that do not declare a permission key are treated as accessible by default; use the allowedIfNoPermissionKey argument to change that behaviour.

Arguments

NameTypeRequiredDescription
formNamestringYesThe name of the form whose access you wish to check
permissionContextstringNo (default="")Optional context for permission lookups (see permissionsservice-haspermission)
permissionContextKeysarrayNoOptional array of context keys for permission lookups (see permissionsservice-haspermission)
allowedIfNoPermissionKeybooleanNo (default=true)Whether or not access is allowed when the form does not declare a permission key