public class RoleAuth extends Auth
Role-based user authentication component. This component implements user access by clasifyng users in groups where each grouphas a set of roles. Later in your script you require one or more roles for the user.If you add new groups to your application then you just add some roles to those groupsand you don't have to modify your sorce code.
Auth
|
+-- RoleAuth
| Author(s): | Julio César Carrascal Urquijo <jcesar@phreaker.net> |
|---|---|
| Version: | 2.4 |
| Methods inherited from Auth | auth, startsession, forcelogin, logout, refreshinfo, _callback, _connect, _findbyusername, _findbyid, _checksession |
| Fields inherited from Auth | $user, $isidentified, $cachelevel, $dbdriver, $hostname, $username, $password, $database, $_conn, $_options |
public void RoleAuth( [ string $options ] );
Constructor.
| Parameters: | ||||||
|
||||||
Returns: void |
||||||
public void requireRoles( );
Require that the user has all roles passed as parameters. Force the user to identify himself (If he hasn't do it before) and ensures thathe has each specified role. You can pass all the roles you need at once.
Returns: void |
| See Also: requireAtLeast() |
public void requireAtLeast( );
Require that the user has at least one of the roles passed as parameters. Force the user to identify himself (If he hasn't do it before) and ensures that hehas "at least" one of the specified roles. You can pass all the roles you need atonce.
Returns: void |
| See Also: requireRoles() |
private array _getRoles( int $userId );
Search for the roles a user. Those roles are in relation to groups it belongs to. Returns an associative arrayfor easy access.
| Parameters: | ||||||
|
||||||
Returns: array role1 => true, role2 => true. |
||||||