Class: GroupAuth

public    class GroupAuth extends Auth

Group-based user authentication component. This component implements user access by clasifyng users in groups, this way you canrequire that the user belongs to certain group to access the script.

Auth
   |
  +-- GroupAuth

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 Method Summary

void GroupAuth([ string $options ])
Constructor.
void requireGroups()
Require that the user belongs to all groups passed as parameters.
void requireAtLeast()
Require that the user belongs to at least to one of this groups.

Private Method Summary

array _getGroups(int $userId)
Search the groups a user belongs to.

Public Method Details

GroupAuth

public    void GroupAuth( [ string $options ] );

Constructor.

Parameters:
string $options = >>null<<
  => val of options.
Returns: void

requireGroups

public    void requireGroups(  );

Require that the user belongs to all groups passed as parameters. Force the user to identify himself (If he hasn't do it before) andensures that he/she belongs to each specified group. You can pass all thegroups you need at once.

Returns: void
See Also: requireAtLeast()

requireAtLeast

public    void requireAtLeast(  );

Require that the user belongs to at least to one of this groups. Force the user to identify himself (If he hasn't do it before) andensures that he belongs "at least" to one of the specified groups. Youcan pass all the groups you need at once.

Returns: void
See Also: requireGroups()

Private Method Details

_getGroups

private    array _getGroups( int $userId );

Search the groups a user belongs to. Returns an associative array for easy access.

Parameters:
int $userId
  the user.
Returns: array
group1 => true, group2 => true.