Backend\Classes\AuthManager

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

Extends:

Implements:

  • Illuminate\Contracts\Auth\Guard
  • Illuminate\Contracts\Auth\StatefulGuard

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

Key to store the auth session data in

protected $userModel

User Model Class

protected $groupModel

User Group Model Class

protected $throttleModel

Throttle Model Class

protected $requireActivation

Flag to require users to be activated to login

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, bool $includeOrphans=true)

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

Parameters
  • string $role
  • bool $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 permissions' owner plugin or module in the format Author.Plugin
  • array $definitions - An array of the menu item definitions.

public void removePermission(string $owner, string $code)

Removes a single back-end permission

Parameters
  • string $owner - Specifies the permissions' owner plugin or module in the format Author.Plugin
  • string $code - The code of the permission to remove

Show inherited public methods

Inherited public methods

  • public void __clone() - defined in October\Rain\Auth\Manager.
  • public void __wakeup() - defined in October\Rain\Auth\Manager.
  • public Models\User attempt(array $credentials=array(), bool $remember=false) - defined in October\Rain\Auth\Manager. Attempt to authenticate a user using the given credentials.
  • public void authenticate(array $credentials, bool $remember=true) - defined in October\Rain\Auth\Manager. Attempts to authenticate the given user according to the passed credentials.
  • public bool check() - defined in October\Rain\Auth\Manager. Check to see if the user is logged in and activated, and hasn't been banned or suspended.
  • public Models\Throttle createThrottleModel() - defined in October\Rain\Auth\Manager. Creates an instance of the throttle model.
  • public Models\User createUserModel() - defined in October\Rain\Auth\Manager. Creates a new instance of the user model.
  • public void extendUserQuery(October\Rain\Database\Builder $query) - defined in October\Rain\Auth\Manager. Extend the query used for finding the user.
  • public Models\Throttle findThrottleByLogin(string $loginName, string $ipAddress) - defined in October\Rain\Auth\Manager. Find a throttle record by login and ip address.
  • public Models\Throttle findThrottleByUserId(integer $userId, string $ipAddress=NULL) - defined in October\Rain\Auth\Manager. Find a throttle record by user id and ip address.
  • public Models\User findUserByCredentials(array $credentials) - defined in October\Rain\Auth\Manager. Finds a user by the given credentials.
  • public mixed findUserById(string $id) - defined in October\Rain\Auth\Manager. Finds a user by the login value.
  • public mixed findUserByLogin(string $login) - defined in October\Rain\Auth\Manager. Finds a user by the login value.
  • public static void forgetInstance() - defined in October\Rain\Auth\Manager. Forget this singleton's instance if it exists.
  • public mixed getImpersonator() - defined in October\Rain\Auth\Manager. Get the original user doing the impersonation.
  • public mixed getUser() - defined in October\Rain\Auth\Manager. Returns the current user, if any.
  • public bool guest() - defined in October\Rain\Auth\Manager. Determine if the current user is a guest.
  • public int|null id() - defined in October\Rain\Auth\Manager. Get the ID for the currently authenticated user.
  • public void impersonate($user) - defined in October\Rain\Auth\Manager. Impersonates the given user and sets properties.
  • public static void instance() - defined in October\Rain\Auth\Manager. Create a new instance of this singleton.
  • public bool isImpersonator() - defined in October\Rain\Auth\Manager. Check to see if the current session is being impersonated.
  • public void login($user, $remember=true) - defined in October\Rain\Auth\Manager. Logs in the given user and sets properties.
  • public Illuminate\Contracts\Auth\Authenticatable loginUsingId(mixed $id, bool $remember=false) - defined in October\Rain\Auth\Manager. Log the given user ID into the application.
  • public void logout() - defined in October\Rain\Auth\Manager. Logs the current user out.
  • public bool once(array $credentials=array()) - defined in October\Rain\Auth\Manager. Log a user into the application without sessions or cookies.
  • public Illuminate\Contracts\Auth\Authenticatable|false onceUsingId(mixed $id) - defined in October\Rain\Auth\Manager. Log the given user ID into the application without sessions or cookies.
  • public Models\User register(array $credentials, bool $activate=false, bool $autoLogin=true) - defined in October\Rain\Auth\Manager. Registers a user with the provided credentials with optional flags.
  • public void setUser($user) - defined in October\Rain\Auth\Manager. Sets the user.
  • public void stopImpersonate() - defined in October\Rain\Auth\Manager. Stop the current session being impersonated and.
  • public Illuminate\Contracts\Auth\Authenticatable|null user() - defined in October\Rain\Auth\Manager. Get the currently authenticated user.
  • public bool validate(array $credentials=array()) - defined in October\Rain\Auth\Manager. Validate a user's credentials.
  • public bool viaRemember() - defined in October\Rain\Auth\Manager. Determine if the user was authenticated via "remember me" cookie.

Protected methods

protected void createUserModelQuery()

{@inheritdoc}

protected void validateUserModel($user)

{@inheritdoc}

Parameters
  • $user

Show inherited protected methods

Inherited protected methods