Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

JUgrSystem Class Reference

Inheritance diagram for JUgrSystem:

Inheritance graph
[legend]
Collaboration diagram for JUgrSystem:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 JUgrSystem ()
 RefreshAll ()
GetInstance ()
 _UpdateSession ()
 _RefreshUsers ()
GetUser ($id, $refresh=false, $cached=false)
GetAllUsers ()
AddUser ($login, $pass, $globalgroup, $globalrole)
 RemoveUser ($idU)
 _RefreshGroups ()
GetGroup ($idG, $refresh=false)
_AccessGroup ($idG, $refresh=false)
GetAllGroups ($refresh=false)
GetGroups ($parent=0, $global=null)
AddGroup ($name, $global, $parent)
 RemoveGroup ($idG)
 _RefreshRoles ()
GetRole ($idR, $refresh=false)
_AccessRole ($idR, $refresh=false)
GetAllRoles ($refresh=false)
AddRole ($name)
 RemoveRole ($idR)

Public Attributes

 $users
 A few users in the system.

 $userslogin
 The login of the system users.

 $groups
 All groups in the system.

 $roles
 All roles in the system.


Detailed Description

Class that manages the Users, Groups and Roles system.

This class also deals with all the stuff about users, groups and roles that are stored in the session. The way it works is that an instance of it is stored in the session and modules access to it through a GetInstance static method that returns the object in session or, if it does not exist, it contructs a new one with the current active user in the system, stores it in session and returns it.

Definition at line 33 of file JUgrSystem.class.php.


Constructor & Destructor Documentation

JUgrSystem::JUgrSystem  ) 
 

The constructor.

It constructs a new JUgrSystem with information stored about the active user in the system. This constructor is not intended to be run directly but through the GetInstance statice method.

Definition at line 49 of file JUgrSystem.class.php.

Referenced by GetInstance().


Member Function Documentation

& JUgrSystem::_AccessGroup idG,
refresh = false
 

Gets the Group object of a group given its id.

Parameters:
idG The id of the group.
refresh If it is true, it will access the DB and refresh the information stored in the session.
Returns:
Group.

Definition at line 276 of file JUgrSystem.class.php.

References JBaseObject::RaiseError().

& JUgrSystem::_AccessRole idR,
refresh = false
 

Gets the Role object of a role given its id.

Parameters:
idR The id of the role.
refresh If it is true, it will access the DB and refresh the information stored in the session.
Returns:
Role.

Definition at line 419 of file JUgrSystem.class.php.

References JBaseObject::RaiseError().

JUgrSystem::_RefreshGroups  ) 
 

Refreshs the information about groups.

Definition at line 226 of file JUgrSystem.class.php.

References Group::GetAllGroupsId().

JUgrSystem::_RefreshRoles  ) 
 

Refreshes the information about roles.

Definition at line 369 of file JUgrSystem.class.php.

References Role::GetAllRolesId().

JUgrSystem::_RefreshUsers  ) 
 

Refreshs the information about users.

Definition at line 111 of file JUgrSystem.class.php.

JUgrSystem::_UpdateSession  ) 
 

Re-stores the object in the session.

Definition at line 103 of file JUgrSystem.class.php.

References JSession::SetVar().

Referenced by GetInstance().

& JUgrSystem::AddGroup name,
global,
parent
 

Adds a new group in the system.

Parameters:
name The name of the group.
global Boolean indicating whether the group is global or not.
parent The parent group of the new one.
Returns:
Group.

Definition at line 336 of file JUgrSystem.class.php.

References Group::Create(), JSystem::GetLastError(), JSystem::IsError(), and JBaseObject::RaiseError().

& JUgrSystem::AddRole name  ) 
 

Adds a new role in the system.

Parameters:
name The name of the role.
Returns:
Role.

Definition at line 453 of file JUgrSystem.class.php.

References Role::Create().

& JUgrSystem::AddUser login,
pass,
globalgroup,
globalrole
 

Adds a new user in the DB.

Parameters:
login The login of the user.
pass The user password.
globalgroup The id of the global group of the user
globalrole The id of the global role of the user
Returns:
User object of the new user.

Definition at line 205 of file JUgrSystem.class.php.

References User::Create().

& JUgrSystem::GetAllGroups refresh = false  ) 
 

Gets all groups in the system.

Parameters:
refresh If true, it refreshs information about groups
Returns:
Array of Group.

Definition at line 298 of file JUgrSystem.class.php.

& JUgrSystem::GetAllRoles refresh = false  ) 
 

Gets all roles in the system.

Parameters:
refresh If true, it will reload information about roles.
Returns:
Array of Group.

Definition at line 441 of file JUgrSystem.class.php.

& JUgrSystem::GetAllUsers  ) 
 

Gets a DBJames object with all users in the system.

Returns:
DBJames object.

Definition at line 192 of file JUgrSystem.class.php.

References User::GetAllUsersId().

& JUgrSystem::GetGroup idG,
refresh = false
 

Gets the Group object of a group given its id. It just takes it from the information in the session.

Parameters:
idG The id of the group.
refresh If it is true, it will access the DB and refresh the information stored in the session.
Returns:
Group.

Definition at line 248 of file JUgrSystem.class.php.

References JSystem::IsError(), and JBaseObject::RaiseError().

& JUgrSystem::GetGroups parent = 0,
global = null
 

Gets the groups that verifies a certain condition

Parameters:
parent The id of the parent group, 0 for groups who have no parent, null for all groups.
global Whether the group must be a global group or not. null for all groups.
Returns:
Array of Group.

Definition at line 313 of file JUgrSystem.class.php.

References Group::GetAllGroupsId().

& JUgrSystem::GetInstance  ) 
 

Static method that returns the JUgrSystem object stored in session. If there isn't any, it will construct a new one with the current active user in the system.

Returns:
JUgrSystem

Definition at line 71 of file JUgrSystem.class.php.

References _UpdateSession(), JSession::ExistsVar(), JSession::GetVar(), JUgrSystem(), and JSession::SetVar().

Referenced by User::AddToGroup(), Group::AddUser(), JSystem::AnonLogin(), DefaultAuth::Authenticate(), User::Create(), Group::Create(), JSystem::GetCurrentGroup(), JSystem::GetCurrentUser(), User::GetGlobalGroup(), User::GetGlobalRole(), User::GetGroups(), Group::GetParent(), User::GetRole(), User::GetRoles(), Group::GetSubgroups(), Group::GetSubgroupsOfUser(), JSystem::InitModule(), JSystem::LoadModuleGlobalGroup(), JSystem::LoadModuleGroup(), JSystem::Login(), HtmlCoreForms::PrintComboRoles(), User::Remove(), Group::Remove(), User::RemoveFromGroup(), and User::SetRole().

& JUgrSystem::GetRole idR,
refresh = false
 

Gets the Role object of a role given its id. It just takes it from the information in the session.

Parameters:
idR The id of the role.
refresh If it is true, it will access the DB and refresh the information stored in the session.
Returns:
Role.

Definition at line 391 of file JUgrSystem.class.php.

References JSystem::IsError(), and JBaseObject::RaiseError().

& JUgrSystem::GetUser id,
refresh = false,
cached = false
 

Gets the User object of an user given its id.

This method won't store anything about the user in the session, so, next time you want to get it, it will access the DB again.

Parameters:
id The id or the login of the user.
refresh If it is true, it will access the DB and refresh the information stored in the session.
cached If true, it will cache the information about this user in the session.
Returns:
User.

Definition at line 131 of file JUgrSystem.class.php.

References JSystem::GetLastError(), JSystem::IsError(), and JBaseObject::RaiseError().

JUgrSystem::RefreshAll  ) 
 

Refreshes the information about users, groups and roles

Definition at line 58 of file JUgrSystem.class.php.

JUgrSystem::RemoveGroup idG  ) 
 

Removes a group from the system.

Parameters:
idG The id of the group.
Returns:
JError if there was any error

Definition at line 353 of file JUgrSystem.class.php.

References JSystem::IsError(), and Group::Remove().

JUgrSystem::RemoveRole idR  ) 
 

Removes a role from the system.

Parameters:
idR The id of the role.
Returns:
JError if there was an error

Definition at line 467 of file JUgrSystem.class.php.

References JSystem::IsError(), and Role::Remove().

JUgrSystem::RemoveUser idU  ) 
 

Removes an user from the DB.

Parameters:
idU The id of the user.

Definition at line 217 of file JUgrSystem.class.php.

References User::Remove().


Member Data Documentation

JUgrSystem::$groups
 

All groups in the system.

Definition at line 37 of file JUgrSystem.class.php.

JUgrSystem::$roles
 

All roles in the system.

Definition at line 38 of file JUgrSystem.class.php.

JUgrSystem::$users
 

A few users in the system.

Definition at line 35 of file JUgrSystem.class.php.

JUgrSystem::$userslogin
 

The login of the system users.

Definition at line 36 of file JUgrSystem.class.php.


The documentation for this class was generated from the following file:
Generated on Wed Nov 19 20:29:41 2003 for James by doxygen 1.3.4