libSmalldb  v0.2
Public Member Functions | List of all members
IAuth Interface Reference

Authenticator interface. More...

Public Member Functions

 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...

Detailed 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.

Member Function Documentation

getUserId ( )

Get user's ID.

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

User's ID, or NULL when nobody is logged in.
hasUserRoles (   $roles)

Check whether user has given role(s).

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

User may have any number of roles.

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

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

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