Backend\Classes\AuthManager

Source: ~/modules/backend/classes/AuthManager.php

Extends:

Back-end authentication manager.

Public properties

There are no public properties in the class.

Show inherited public properties

Inherited public properties

Protected properties

protected static $instance

protected $sessionKey

protected $userModel

protected $groupModel

protected $throttleModel

protected $requireActivation

protected static $permissionDefaults

protected array $callbacks

Cache of registration callbacks.

protected array $permissions

List of registered permissions.

protected array $permissionRoles

List of registered permission roles.

protected array $permissionCache

Cache of registered permissions.

Show inherited protected properties

Inherited protected properties

Public methods

public void hasPermissionsForRole($role)
Parameters
  • $role

public array listPermissions()

Returns a list of the registered permissions items.

public array listPermissionsForRole(string $role, $includeOrphans=true)

Returns an array of registered permissions belonging to a given role code

Parameters
  • string $role
  • $includeOrphans

public array listTabbedPermissions()

Returns an array of registered permissions, grouped by tabs.

public void registerCallback(callable $callback)

Registers a callback function that defines authentication permissions. The callback function should register permissions by calling the manager's registerPermissions() function. The manager instance is passed to the callback function as an argument. Usage:

BackendAuth::registerCallback(function($manager){
    $manager->registerPermissions([...]);
});
Parameters
  • callable $callback - A callable function.

public void registerPermissions(string $owner, array $definitions)

Registers the back-end permission items. The argument is an array of the permissions. The array keys represent the permission codes, specific for the plugin/module. Each element in the array should be an associative array with the following keys:

  • label - specifies the menu label localization string key, required.
  • order - a position of the item in the menu, optional.
  • comment - a brief comment that describes the permission, optional.
  • tab - assign this permission to a tabbed group, optional.
Parameters
  • string $owner - Specifies the menu items owner plugin or module in the format Vendor/Module.
  • array $definitions - An array of the menu item definitions.

Show inherited public methods

Inherited public methods

Protected methods

Show inherited protected methods

Inherited protected methods