hasPermission()
Overview
public boolean function hasPermission(
required string permissionKey
, string context = ""
, array contextKeys
, string userId = ID of logged in user
, boolean forceGrantByDefault = false
)
Returns whether or not the user has permission to the given set of keys.
See Website users and permissioning for a full guide to website users and permissions.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| permissionKey | string | Yes | The permission key as defined in `Config.cfc` |
| context | string | No (default="") | Optional named context |
| contextKeys | array | No | Array of keys for the given context (required if context supplied) |
| userId | string | No (default=ID of logged in user) | ID of the user whose permissions we wish to check |
| forceGrantByDefault | boolean | No (default=false) | Whether or not to force a granted permission by default, unless a specific context permission overrides that grant |