Public Member Functions | Static Public Member Functions | Protected Member Functions

UserGroup Class Reference

Inheritance diagram for UserGroup:
Collaboration diagram for UserGroup:

List of all members.

Public Member Functions

 __construct ($paramarray=array())
 insert ()
 update ()
 delete ()
 __get ($param)
 add ($users)
 remove ($users)
 grant ($tokens, $access= 'full')
 deny ($tokens)
 revoke ($tokens)
 can ($token, $access= 'full')
 get_access ($token)
 clear_permissions_cache ()
 load_permissions_cache ()
 member ($user_id)

Static Public Member Functions

static default_fields ()
static create ($paramarray)
static get ($group)
static get_by_id ($id)
static get_by_name ($name)
static exists ($group)
static name ($id)
static id ($name)

Protected Member Functions

 set_member_list ()
 load_member_cache ($refresh=false)

Detailed Description

Habari UserGroup Class

Definition at line 11 of file usergroup.php.


Constructor & Destructor Documentation

UserGroup::__construct ( paramarray = array()  ) 

Constructor for the UserGroup class

Parameters:
array $paramarray an associative array of UserGroup fields

Reimplemented from QueryRecord.

Definition at line 34 of file usergroup.php.


Member Function Documentation

UserGroup::__get ( param  ) 

function __get magic get function for returning virtual properties of the class

Parameters:
mixed the property to get
Returns:
mixed the property

Reimplemented from QueryRecord.

Definition at line 164 of file usergroup.php.

UserGroup::add ( users  ) 

Add one or more users to this group

Parameters:
mixed $users a user ID or name, or an array of the same

Definition at line 192 of file usergroup.php.

UserGroup::can ( token,
access = 'full' 
)

Determine whether members of a group can do something. This function should not be used to determine composite permissions among several groups

Parameters:
mixed a permission ID or name
Returns:
boolean If this group has been granted and not denied this permission, return true. Otherwise, return false.
See also:
ACL::group_can()
ACL::user_can()

Definition at line 271 of file usergroup.php.

UserGroup::clear_permissions_cache (  ) 

Clear permissions cache.

Definition at line 300 of file usergroup.php.

static UserGroup::create ( paramarray  )  [static]

Create a new UserGroup object and save it to the database

Parameters:
array $paramarray An associative array of UserGroup fields
Returns:
UserGroup the UserGroup that was created
Todo:
Make this function accept only a name, since you can't set an id into an autoincrement field, and we don't try.

Definition at line 52 of file usergroup.php.

Referenced by ACL::rebuild_permissions(), and AdminGroupsHandler::update_groups().

static UserGroup::default_fields (  )  [static]

get default fields for this record

Returns:
array an array of the fields used in the UserGroup table

Definition at line 22 of file usergroup.php.

Referenced by UserGroups::get().

UserGroup::delete (  ) 

Delete a UserGroup

Reimplemented from QueryRecord.

Definition at line 136 of file usergroup.php.

UserGroup::deny ( tokens  ) 

Deny one or more permission tokens to this group

Parameters:
mixed The permission ID or name to be denied, or an array of the same

Definition at line 244 of file usergroup.php.

static UserGroup::exists ( group  )  [static]

Determine whether a group exists

Parameters:
mixed The name or ID of the group
Returns:
bool Whether the group exists or not

Definition at line 361 of file usergroup.php.

Referenced by User::insert(), and AdminGroupsHandler::update_groups().

static UserGroup::get ( group  )  [static]

Fetch a group from the database by ID or name. This is a wrapper for get_by_id() and get_by_name()

Parameters:
mixed $group A group ID or name
Returns:
mixed UserGroup object, or boolean false

Definition at line 326 of file usergroup.php.

Referenced by ACL::create_token(), and member().

UserGroup::get_access ( token  ) 

Return the access bitmask for a specific token for this group.

Parameters:
string $token The
Returns:

Definition at line 287 of file usergroup.php.

static UserGroup::get_by_id ( id  )  [static]

Select a group from the DB by its ID

Parameters:
int A group ID
Returns:
mixed A UserGroup object, or boolean false

Definition at line 341 of file usergroup.php.

Referenced by AdminGroupsHandler::ajax_groups(), get(), AdminGroupsHandler::get_group(), ACL::grant_group(), AdminGroupsHandler::post_group(), ACL::revoke_group_token(), and AdminGroupsHandler::update_groups().

static UserGroup::get_by_name ( name  )  [static]

Select a group from the DB by its name

Parameters:
string A group name
Returns:
mixed A UserGroup object, or boolean false

Definition at line 351 of file usergroup.php.

Referenced by create(), get(), and ACL::rebuild_permissions().

UserGroup::grant ( tokens,
access = 'full' 
)

Assign one or more new permission tokens to this group

Parameters:
mixed A permission token ID, name, or array of the same

Definition at line 228 of file usergroup.php.

Referenced by deny().

static UserGroup::id ( name  )  [static]

Given a group's name, return its ID

Parameters:
string a group's name
Returns:
int the group's ID, or false if the group doesn't exist

Definition at line 383 of file usergroup.php.

Referenced by ACL::get_group_token_access(), and User::in_group().

UserGroup::insert (  ) 

Save a new UserGroup to the UserGroup table

Reimplemented from QueryRecord.

Definition at line 73 of file usergroup.php.

UserGroup::load_member_cache ( refresh = false  )  [protected]

Cache the member ids that belong to this group

Parameters:
boolean $refresh Optional. If true, refresh the cache

Definition at line 413 of file usergroup.php.

Referenced by __get(), add(), remove(), and set_member_list().

UserGroup::load_permissions_cache (  ) 

Load permissions cache.

Definition at line 309 of file usergroup.php.

Referenced by __get(), can(), and get_access().

UserGroup::member ( user_id  ) 

Determine whether the specified user is a member of the group

Parameters:
mixed A user ID or name
Returns:
bool True if the user is in the group, otherwise false

Definition at line 395 of file usergroup.php.

static UserGroup::name ( id  )  [static]

Given a group's ID, return its friendly name

Parameters:
int a group's ID
Returns:
string the group's name or false if the group doesn't exist

Definition at line 371 of file usergroup.php.

Referenced by add(), insert(), remove(), set_member_list(), and update().

UserGroup::remove ( users  ) 

Remove one or more user from this group

Parameters:
mixed $users A user ID or name, or an array of the same

Definition at line 211 of file usergroup.php.

UserGroup::revoke ( tokens  ) 

Remove one or more permissions from a group

Parameters:
mixed a permission ID, name, or array of the same

Definition at line 253 of file usergroup.php.

UserGroup::set_member_list (  )  [protected]

Set the member list for this group

Definition at line 120 of file usergroup.php.

Referenced by insert(), and update().

UserGroup::update (  ) 

Updates an existing UserGroup in the DB

Reimplemented from QueryRecord.

Definition at line 101 of file usergroup.php.

Referenced by add(), and remove().


The documentation for this class was generated from the following file: