acl

acl is a simple Access Control List class. Essentially it checks to see if a keyword (access word) is associated with a particular user or not. There are also functions to add or remove access words. There is also a simple function verify if the user typed in the correct password for his account.

Parent Class

None


Static Properties

$userTable
There is rarely a need to access this property directly. It is used internally to the authenticate() method
Data Type: table
Default Value: null
$userTableName
The name of your user table in your database. Set this prior to calling the authenticate() method.
Data Type: string
Default Value: ‘user’
$usernameField
The name of the field in your user table that contains the username.
Data Type: string
Default Value: ‘username’
$passwordFieldName
The name of the field in your user table that contains the password.
Data Type: string
Default Value: ‘passwd’
$aclTableName
The name of your ACL table in your database. Set this prior to calling the hasAccess(), addAccess() or removeAccess() methods.
Data Type: string
Default Value: ‘acl’

Static Methods

boolean authenticate( string $username, string $password )
Verifies if the user supplied the correct username and password
Parameters:
$username (string)
$password (string)
Returns:
True if the username and password match, otherwise false.
Example:
boolean hasAccess( string $accessWord, int $userId )
Determines if the specified user has the access word associated with his id. ie: Can he access whatever is controlled by this access word?
Parameters:
$accessWord (string)
$userId (string) defaults to 0 which tells hasAccess() to use the userId found during the last call to authenticate() method.
Returns:
True if the user and access word are associated
Example:
void addAccess( string $accessWord, int $userId )
Associates the access word with the specified user id. ie: Adds access to whatever is controlled by this access word
Parameters:
$accessWord (string)
$userId (string) defaults to 0 which tells addAccess() to use the userId found during the last call to authenticate() method.
Returns:
null
Example:
void removeAccess( string $accessWord, int $userId )
Removes any association between the access word with the specified user id. ie: Removes access to whatever is controlled by this access word
Parameters:
$accessWord (string)
$userId (string) defaults to 0 which tells removeAccess() to use the userId found during the last call to authenticate() method.
Returns:
null
Example: