libSmalldb  v0.7-66-gb94d22a
Public Member Functions | List of all members
IAuth Interface Reference

Description

Authenticator interface.

State machine requires some basic informations about current user so it can determine whether or not it is allowed to trigger a transition or expose state machine state.

Inheritance diagram for IAuth

Public Member Functions

 checkSession ()
 Check session and setup whatever is neccessary (cookies and so). More...
 
 getSessionMachine ()
 Get session machine which manages all stuff around login and session. More...
 
 getUserId ()
 Get user's ID. More...
 
 hasUserRoles ($roles)
 Check whether user has given role(s). More...
 
 isAllMighty ()
 Is user all mighty? (Admin or something like that.) More...
 

Member Function Documentation

◆ checkSession()

checkSession ( )

Check session and setup whatever is neccessary (cookies and so).

This shall be called when context is ready, but before application does anything.

Implemented in CookieAuth, and AllowAllAuth.

◆ getSessionMachine()

getSessionMachine ( )

Get session machine which manages all stuff around login and session.

Implemented in CookieAuth, and AllowAllAuth.

◆ getUserId()

getUserId ( )

Get user's ID.

User's ID is limited to single scalar value (any integer or string).

Returns
User's ID, or NULL when nobody is logged in.

Implemented in CookieAuth, and AllowAllAuth.

◆ hasUserRoles()

hasUserRoles (   $roles)

Check whether user has given role(s).

Smalldb does not understand user roles, it can only check whether user's roles contain one of required values. User's roles are global and they are not related to any instance of anything.

User may have any number of roles.

Parameters
$rolesName of required role (string), or array of required roles (array of strings).
Returns
TRUE when user has at least one of requested roles, or FALSE otherwise.

Implemented in CookieAuth, and AllowAllAuth.

◆ isAllMighty()

isAllMighty ( )

Is user all mighty? (Admin or something like that.)

When this function returns true, access control will be disabled.

Implemented in CookieAuth, and AllowAllAuth.