Class PHPDS_user

Description

A class representing a user in PHPDevShell.

Can be used to examine / modify an existing user, or create / import a new user

  • author: Greg, Jason
  • version: 1.0.1
  • date: 20091125

Located in /PHPDS_user.class.php (line 25)

PHPDS_dependant
   |
   --user
      |
      --PHPDS_user
Variable Summary
Method Summary
boolean belongsToGroup ([integer $user_id = false], integer $user_group)
boolean belongsToRole ([integer $user_id = false], integer $user_role)
boolean canAccessMenu (mixed $menu_id, [string $type = 'menu_id'])
void controlLogin ()
integer currentUserID ()
string findGroupChildren (int $group_id)
mixed getGroups ([string $user_id = false], [boolean $return_array = false], [ $alias_only = false])
mixed getRoles ([string $user_id = false], [boolean $return_array = false])
string getUserIp ()
boolean groupExist (integer $group_id)
boolean isLoggedIn ()
boolean isRoot ([mixed $user_id = false])
boolean, isSameGroup ($user_id $user_id)
boolean roleExist (integer $role_id)
mixed setGroupQuery (string $query_request, [string $query_root_request = false])
mixed setRoleQuery (string $query_request, [string $query_root_request = false])
void userConfig ()
string userIp ()
Variables
array $groupsArray (line 50)

Set groups that exists.

  • access: public
string $mergeGroups (line 32)

Stores string of groups for specific user.

  • access: public
string $mergeRoles (line 38)

Stores string of roles for specific user.

  • access: public
array $parentGroups (line 56)

Array contains parent groups.

  • access: public
array $rolesArray (line 44)

Set roles that exists.

  • access: public

Inherited Variables

Inherited from PHPDS_dependant

PHPDS_dependant::$dependance
PHPDS_dependant::$parent
Methods
belongsToGroup (line 143)

Check if user belongs to given group. Returns true if user belongs to user group.

  • return: Returns true if user belongs to user group.
  • author: Jason Schoeman <titan@phpdevshell.org>
  • access: public
boolean belongsToGroup ([integer $user_id = false], integer $user_group)
  • integer $user_id
  • integer $user_group
belongsToRole (line 130)

Check if user belongs to given role. Returns true if user belongs to user role.

  • return: Returns true if user belongs to user role.
  • author: Jason Schoeman <titan@phpdevshell.org>
  • access: public
boolean belongsToRole ([integer $user_id = false], integer $user_role)
  • integer $user_id
  • integer $user_role
canAccessMenu (line 336)

Check if a user has access to a given menu id.

  • return: Will return requested variable if user has access to requested menu item menu item.
  • version: 1.0.1
  • date: 20091105 fixed a possible warning when the menu is not in the list (i.e. the user is not allowed)
  • access: public
boolean canAccessMenu (mixed $menu_id, [string $type = 'menu_id'])
  • mixed $menu_id: This can have both the menu id as an integer or as a string.
  • string $type: The type of item requested, menu_id, menu_name etc...
controlLogin (line 378)

Actual processing of login page.

  • author: Jason Schoeman
  • date: 2011-06-20
  • access: public
void controlLogin ()
currentUserID (line 255)

Returns current logged in user id.

  • access: public
integer currentUserID ()
findGroupChildren (line 94)

Will dig deeper for children of groups.

  • access: public
string findGroupChildren (int $group_id)
  • int $group_id
getGroups (line 81)

This function gets all group id's for given user ids, while returning a string divided by ',' character or an array with ids.

To pull multiple user groups, provide a string for $user_ids like so : '2,5,10,19'.

  • return: If $return_array = false a comma delimited string will be returned, else an array.
  • author: Jason Schoeman <titan@phpdevshell.org>
  • access: public
mixed getGroups ([string $user_id = false], [boolean $return_array = false], [ $alias_only = false])
  • string $user_id: Leave this field empty if you want skip if user is root.
  • boolean $return_array
  • $alias_only
getRoles (line 67)

This function gets all role id's for a given user id, while returning a string divided by ',' character or an array with ids.

To pull multiple user roles, provide a string for $user_ids like so: '2,5,10,19'.

  • return: If $return_array = false a comma delimited string will be returned, else an array.
  • author: Jason Schoeman <titan@phpdevshell.org>
  • access: public
mixed getRoles ([string $user_id = false], [boolean $return_array = false])
  • string $user_id
  • boolean $return_array
getUserIp (line 299)

Simple method to return users IP, this method will be improved in the future if needed.

  • version: 1.0.1
  • date: 20110315 (v1.0.1) (greg) fix a possible undef when not used through a webserver
  • access: public
string getUserIp ()
groupExist (line 117)

Simple check to see if a certain group exists.

  • access: public
boolean groupExist (integer $group_id)
  • integer $group_id
isLoggedIn (line 316)

Check is user is logged in, return false if not.

  • access: public
boolean isLoggedIn ()
isRoot (line 218)

Check if user is a root user.

  • date: 20100608 (v1.0.1) (greg) moved to query system
  • access: public
boolean isRoot ([mixed $user_id = false])
  • mixed $user_id: If not logged in user, what user should be checked (primary role check only).
isSameGroup (line 275)

Check if the currently logged in user is the same group as the given user.

This can be used to check if the current user is allowed access to the given user's data

  • return: whether the current user is in the same group
  • author: greg
  • version: 1.0
  • date: 20100222
  • access: public
boolean, isSameGroup ($user_id $user_id)
  • $user_id $user_id: integer, the ID of the other user
roleExist (line 106)

Simple check to see if a certain role exists.

  • access: public
boolean roleExist (integer $role_id)
  • integer $role_id
setGroupQuery (line 195)

Creates a query to extend a group query, it will return false if user is root so everything can get listed.

This is meant to be used inside an existing group query.

  • access: public
mixed setGroupQuery (string $query_request, [string $query_root_request = false])
  • string $query_request: Normal query to be returned if user is not a root user.
  • string $query_root_request: If you want a query to be processed for a root user seperately.
setRoleQuery (line 171)

Creates a query to extend a role query, it will return false if user is root so everything can get listed.

This is meant to be used inside an existing role query.

  • access: public
mixed setRoleQuery (string $query_request, [string $query_root_request = false])
  • string $query_request: Normal query to be returned if user is not a root user.
  • string $query_root_request: If you want a query to be processed for a root user seperately.
userConfig (line 355)

Simply writes user session data.

  • author: Jason Schoeman
  • version: 1.1
  • date: 20110622
  • access: public
void userConfig ()
userIp (line 286)

Simple method to return users IP, this method will be improved in the future if needed.

  • access: public
string userIp ()

Inherited Methods

Inherited From PHPDS_dependant

PHPDS_dependant::__construct()
PHPDS_dependant::construct()
PHPDS_dependant::debugInstance()
PHPDS_dependant::factory()
PHPDS_dependant::factoryWith()
PHPDS_dependant::info()
PHPDS_dependant::log()
PHPDS_dependant::PHPDS_dependance()
PHPDS_dependant::_log()
PHPDS_dependant::__call()
PHPDS_dependant::__get()
PHPDS_dependant::__set()

Documentation generated on Tue, 09 Aug 2011 09:05:25 +0200 by phpDocumentor 1.4.3