Piwik\Access\

Capability

Base class for capabilities that plugins add using the Access.Capability.addCapabilities event.

Methods

The abstract class defines the following methods:

  • getId() — Returns the unique ID of the capability, e.g.
  • getName() — Returns the display name of the capability.
  • getCategory() — Returns the category the capability is grouped under.
  • getDescription() — Returns the description of the capability.
  • getIncludedInRoles() — Returns the roles that include this capability by default, e.g.
  • getHelpUrl() — Returns the URL of the help page for the capability.
  • hasRoleCapability() — Returns whether the given role includes this capability by default.

getId()

Returns the unique ID of the capability, e.g. 'tagmanager_publish_live_container'. It may only contain a-zA-Z0-9_- and must not be longer than 50 characters.

Signature

  • Returns: string — The capability ID.

getName()

Returns the display name of the capability.

Signature

  • Returns: string — The translated name.

getCategory()

Returns the category the capability is grouped under.

Signature

  • Returns: string — The translated category name.

getDescription()

Returns the description of the capability.

Signature

  • Returns: string — The translated description.

getIncludedInRoles()

Returns the roles that include this capability by default, e.g. Piwik\Access\Role\Admin::ID.

Signature

  • Returns: array — The role IDs.

getHelpUrl()

Returns the URL of the help page for the capability.

Signature

  • Returns: string — The URL, or an empty string if there is none.

hasRoleCapability()

Returns whether the given role includes this capability by default.

Signature

  • It accepts the following parameter(s):

    • $idRole (string) — The role ID.
  • Returns: bool — True if the role is listed in getIncludedInRoles().