AuthHelper
in package
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()
Constructor
public
__construct([array<string|int, User> $users = [] ]) : AuthHelper
Parameters
- $users : array<string|int, User> = []
-
(optional)
Tags
Return values
AuthHelper —addUser()
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
Return values
AuthHelper —addUserObject()
Defines a new User.
public
addUserObject(User $user) : AuthHelper
Parameters
- $user : User
-
The user Object.
Tags
Return values
AuthHelper —checkCookies()
Checks if there is cookie data for skin/accent. If yes, override crudkit config.
public
checkCookies() : void
Return values
void —getUserId()
Gets the current user id. Returns '' if not logged in.
public
getUserId() : string
Return values
string —getUsers()
Gets all users
public
getUsers() : array<string|int, CurdkitUser>
Return values
array<string|int, CurdkitUser> —isAdmin()
Checks if the user is an admin user (and if the user is logged in)
public
isAdmin() : bool
Return values
bool —isLoggedIn()
Checks if the user is logged in.
public
isLoggedIn() : bool
Return values
bool —onAfterLogin()
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.