hasPermissions()

Overview

public struct function hasPermissions(
      required array  permissionKeys
    ,          string context        = ""
    ,          array  contextKeys   
    ,          string userId         = ID of logged in user
)

Returns whether or not the user has permission to the given set of keys. Returns a struct with permission keys as keys and boolean values for whether user has permission for each key.

See CMS permissioning for a full guide to CMS users and permissions.

Arguments

NameTypeRequiredDescription
permissionKeysarrayYesThe permission keys as defined in `Config.cfc`
contextstringNo (default="")Optional named context
contextKeysarrayNoArray of keys for the given context (required if context supplied)
userIdstringNo (default=ID of logged in user)ID of the user whose permissions we wish to check