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
authenticate()
methodData Type: table
Default Value: null
authenticate()
method.Data Type: string
Default Value: ‘user’
Data Type: string
Default Value: ‘username’
Data Type: string
Default Value: ‘passwd’
hasAccess(), addAccess() or removeAccess()
methods.Data Type: string
Default Value: ‘acl’
Static Methods
Parameters:
$username
(string)$password
(string)Returns:
True if the username and password match, otherwise false.
Example:
1 2 3 4 5 |
if \ipinga\acl::authenticate($_POST['username'],$_POST['password']) { echo 'User is who he says he is'; } else { echo 'User might not be who you think he is'; }; |
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:
1 2 3 4 5 |
if \ipinga\acl::hasAccess('accounting_menu') { echo 'The user can view the accounting menu'; } else { echo 'Do not show the accounting menu to this user'; }; |
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:
1 |
\ipinga\acl::addAccess('accounting_menu',52); // give user #52 access to the accounting menu |
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:
1 |
\ipinga\acl::removeAccess('accounting_menu',52); // remove access to the accounting menu for user #52 |