Key
abstract class Key extends ConcreteObject (View source)
Constants
ACCESS_TYPE_INCLUDE |
Access type: inclusive. |
ACCESS_TYPE_EXCLUDE |
Access type: exclusive. |
ACCESS_TYPE_ALL |
Access type: any. |
Properties
$error | from ConcreteObject | ||
protected ObjectInterface|null | $permissionObject | The object for which this permission is for (for example, a Page instance). |
|
bool|int|string | $pkID | ||
string | $pkName | ||
string | $pkHandle | ||
string | $pkDescription | ||
bool|int|string | $pkCategoryID | ||
string | $pkCategoryHandle | ||
bool|int|string|null | $pkgID | ||
bool|int|string | $pkCanTriggerWorkflow | ||
bool|int|string | $pkHasCustomClass | ||
ObjectInterface|null | $permissionObjectToCheck |
Methods
Get the identifiers (keys) and descriptions (values) of the access types.
Returns whether a permission key can start a workflow.
Returns whether a permission key has a custom class.
Returns the name for this permission key.
Returns the display name for this permission key (localized and escaped accordingly to $format).
Returns the handle for this permission key.
Returns the description for this permission key.
Returns the display description for this permission key (localized and escaped accordingly to $format).
Returns the ID for this permission key.
Returns the ID for the category of this permission key.
Returns the handle for the category of this permission key.
Set the object for which this permission is for (for example, a Page instance).
Set the actual object that should be checked for this permission (for example, a Page instance).
Get the object for which this permission is for (for example, a Page instance).
Does this permission key have a form (located at elements/permission/keys/
Get the ID of the package that defines this permission key.
Get the handle of the package that defines this permission key.
Returns the list of all permissions of this category.
Export the list of all permissions of this category to a SimpleXMLElement instance.
Get a permission key given its handle.
Mark this permission key as having (or not) a custom class.
Check if the current user is of for this key and its current permission object (if any).
Delete this permission key.
A shortcut for grabbing the current assignment and passing into that object.
No description
No description
No description
Export the strings that should be translated.
Details
loadError($error)
No description
isError()
No description
getError()
No description
setPropertiesFromArray($arr)
No description
static
camelcase($file)
No description
static
uncamelcase($string)
No description
array
getSupportedAccessTypes()
Get the identifiers (keys) and descriptions (values) of the access types.
bool
canPermissionKeyTriggerWorkflow()
Returns whether a permission key can start a workflow.
bool
permissionKeyHasCustomClass()
Returns whether a permission key has a custom class.
string
getPermissionKeyName()
Returns the name for this permission key.
string
getPermissionKeyDisplayName(string $format = 'html')
Returns the display name for this permission key (localized and escaped accordingly to $format).
string
getPermissionKeyHandle()
Returns the handle for this permission key.
string
getPermissionKeyDescription()
Returns the description for this permission key.
string
getPermissionKeyDisplayDescription(string $format = 'html')
Returns the display description for this permission key (localized and escaped accordingly to $format).
int
getPermissionKeyID()
Returns the ID for this permission key.
int
getPermissionKeyCategoryID()
Returns the ID for the category of this permission key.
string
getPermissionKeyCategoryHandle()
Returns the handle for the category of this permission key.
setPermissionObject(ObjectInterface|null $object)
Set the object for which this permission is for (for example, a Page instance).
getPermissionObjectToCheck()
Set the actual object that should be checked for this permission (for example, a Page instance).
ObjectInterface|null
getPermissionObject()
Get the object for which this permission is for (for example, a Page instance).
static Key[]
loadAll()
Get the list of all the defined permission keys.
bool
hasCustomOptionsForm()
Does this permission key have a form (located at elements/permission/keys/
int|null
getPackageID()
Get the ID of the package that defines this permission key.
string|null
getPackageHandle()
Get the handle of the package that defines this permission key.
static Key[]
getList(string $pkCategoryHandle, array $filters = [])
Returns the list of all permissions of this category.
SimpleXMLElement
export(SimpleXMLElement $axml)
Export this permission key to a SimpleXMLElement instance.
static
exportList(SimpleXMLElement $xml)
Export the list of all permissions of this category to a SimpleXMLElement instance.
static Key[]
getListByPackage(Package|Package $pkg)
Get the list of permission keys defined by a package.
Note, this queries both the pkgID found on the PermissionKeys table AND any permission keys of a special type installed by that package, and any in categories by that package.
static Key
import(SimpleXMLElement $pk)
Import a permission key from a SimpleXMLElement element.
static Key|null
getByID(int $pkID)
Get a permission key given its ID.
static Key|null
getByHandle(string $pkHandle)
Get a permission key given its handle.
static
add(string $pkCategoryHandle, string $pkHandle, string $pkName, string $pkDescription, bool $pkCanTriggerWorkflow, bool $pkHasCustomClass, Package|Package|null $pkg = false)
Adds an permission key.
setPermissionKeyHasCustomClass(bool $pkHasCustomClass)
Mark this permission key as having (or not) a custom class.
can()
deprecated
deprecated
No description
bool
validate()
Check if the current user is of for this key and its current permission object (if any).
delete()
Delete this permission key.
ListItem[]
getAccessListItems()
A shortcut for grabbing the current assignment and passing into that object.
Assignment
getPermissionAssignmentObject()
No description
Access|null
getPermissionAccessObject()
No description
int|null
getPermissionAccessID()
No description
exportAccess(SimpleXMLElement $pxml)
No description
static Translations
exportTranslations()
Export the strings that should be translated.
static protected Key|null
load(int|mixed $key, string $loadBy = 'pkID')
Load a permission key by its ID (or whatever is passed to $loadBy).