Menu

## AuthHelper
in package

AuthHelper.php : 8

Provides functionality for user/permisson handling.

### Table of Contents

__construct() : AuthHelper
  Constructor
addUser() : AuthHelper
  Defines a new User.
addUserObject() : AuthHelper
  Defines a new User.
checkCookies() : void
  Checks if there is cookie data for skin/accent. If yes, override crudkit config.
getUserId() : string
  Gets the current user id. Returns '' if not logged in.
getUsers() : array<string|int, CurdkitUser>
  Gets all users
isAdmin() : bool
  Checks if the user is an admin user (and if the user is logged in)
isLoggedIn() : bool
  Checks if the user is logged in.
onAfterLogin() : AuthHelper
  Register event handler. Occours after a user has logged in successfully.

### Methods

#### __construct()

AuthHelper.php : 29

Constructor

`public __construct([array<string|int, User> $users = [] ]) : AuthHelper`

##### Parameters

$users : array<string|int, User> = []

  (optional)

##### Tags

stackable

##### Return values

AuthHelper —

#### addUser()

AuthHelper.php : 75

Defines a new User.

`public addUser(string $id, string $password[, RestrictionSet $restrictionSet = null ][, Startpage $startpage = null ]) : AuthHelper`

##### Parameters

$id : string

  The user ID

$password : string

  The password for this user

$restrictionSet : RestrictionSet = null

  (optional) The restriction set (permissions) for this user

$startpage : Startpage = null

  (optional) The startpage for this user

##### Tags

stackable

##### Return values

AuthHelper —

#### addUserObject()

AuthHelper.php : 50

Defines a new User.

`public addUserObject(User $user) : AuthHelper`

##### Parameters

$user : User

  The user Object.

##### Tags

stackable

##### Return values

AuthHelper —

#### checkCookies()

AuthHelper.php : 202

Checks if there is cookie data for skin/accent. If yes, override crudkit config.

`public checkCookies() : void`

##### Return values

void —

#### getUserId()

AuthHelper.php : 129

Gets the current user id. Returns '' if not logged in.

`public getUserId() : string`

##### Return values

string —

#### getUsers()

AuthHelper.php : 60

Gets all users

`public getUsers() : array<string|int, CurdkitUser>`

##### Return values

array<string|int, CurdkitUser> —

#### isAdmin()

AuthHelper.php : 119

Checks if the user is an admin user (and if the user is logged in)

`public isAdmin() : bool`

##### Return values

bool —

#### isLoggedIn()

AuthHelper.php : 109

Checks if the user is logged in.

`public isLoggedIn() : bool`

##### Return values

bool —

#### onAfterLogin()

AuthHelper.php : 147

Register event handler. Occours after a user has logged in successfully.

`public onAfterLogin(callable $callback) : AuthHelper`

    $f = function(string $username, bool $isAdmin){...};
    authHelper->onAfterLogin($f);

##### Parameters

$callback : callable

  Callback function which is beeing called if this event occours.

##### Tags

event
stackable

##### Return values

AuthHelper —

## Search results