PHPDevShell 3.1.3-Stable
PHP OOP RAD Development Framework
PHPDS_user Class Reference
Inheritance diagram for PHPDS_user:
PHPDS_dependant

Public Member Functions

 getRoles ($user_id=false, $return_array=false)
 getGroups ($user_id=false, $return_array=false, $alias_only=false)
 findGroupChildren ($group_id)
 roleExist ($role_id)
 groupExist ($group_id)
 belongsToRole ($user_id=false, $user_role=null, $alias=null)
 belongsToGroup ($user_id=null, $user_group=null, $alias=null)
 groupCan ($alias, $user_id=null)
 setRoleQuery ($query_request, $query_root_request=false)
 setGroupQuery ($query_request, $query_root_request=false)
 isRoot ($user_id=false)
 currentUserID ()
 isSameGroup ($user_id)
 userIp ()
 getUserIp ()
 isLoggedIn ()
 canAccessMenu ($menu_id, $type= 'menu_id')
 userConfig ()
 controlLogin ()

Data Fields

 $mergeGroups
 $mergeRoles
 $rolesArray
 $groupsArray
 $parentGroups
 $userBelongsToGroupByAlias

Member Function Documentation

belongsToGroup ( user_id = null,
user_group = null,
alias = null 
)

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

Parameters:
integer$user_id
integer$user_group
string$alias
Returns:
boolean Returns true if user belongs to user group.
Author:
Jason Schoeman <titan@phpdevshell.org>
belongsToRole ( user_id = false,
user_role = null,
alias = null 
)

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

Parameters:
integer$user_id
integer$user_role
string$alias
Returns:
boolean Returns true if user belongs to user role.
Author:
Jason Schoeman <titan@phpdevshell.org>
canAccessMenu ( menu_id,
type = 'menu_id' 
)

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

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)
Parameters:
mixedThis can have both the menu id as an integer or as a string.
stringThe type of item requested, menu_id, menu_name etc...
Returns:
boolean Will return requested variable if user has access to requested menu item menu item.
controlLogin ( )

Actual processing of login page.

1.0.0

Date:
2011-06-20
Author:
Jason Schoeman
currentUserID ( )

Returns current logged in user id.

Returns:
integer
findGroupChildren ( group_id)

Will dig deeper for children of groups.

Parameters:
int$group_id
Returns:
string
getGroups ( user_id = false,
return_array = false,
alias_only = false 
)

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'.

Parameters:
string$user_idLeave this field empty if you want skip if user is root.
boolean$return_array
Returns:
mixed If $return_array = false a comma delimited string will be returned, else an array.
Author:
Jason Schoeman <titan@phpdevshell.org>
getRoles ( user_id = false,
return_array = false 
)

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'.

Parameters:
string$user_id
boolean$return_array
Returns:
mixed If $return_array = false a comma delimited string will be returned, else an array.
Author:
Jason Schoeman <titan@phpdevshell.org>
getUserIp ( )

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
Returns:
string
groupCan ( alias,
user_id = null 
)

Check if user belongs to given group by alias for performed actions on a page. Returns true if user belongs to user group.

Parameters:
string$alias
integer$user_id
groupExist ( group_id)

Simple check to see if a certain group exists.

Parameters:
integer$group_id
Returns:
boolean
isLoggedIn ( )

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

Returns:
boolean
isRoot ( user_id = false)

Check if user is a root user.

Date:
20100608 (v1.0.1) (greg) moved to query system
Parameters:
mixed$user_idIf not logged in user, what user should be checked (primary role check only).
Returns:
boolean
isSameGroup ( user_id)

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

Date:
20100222
Version:
1.0
Author:
greg
Parameters:
$user_idinteger, the ID of the other user
Returns:
boolean, whether the current user is in the same group
roleExist ( role_id)

Simple check to see if a certain role exists.

Parameters:
integer$role_id
Returns:
boolean
setGroupQuery ( query_request,
query_root_request = false 
)

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.

Parameters:
string$query_requestNormal query to be returned if user is not a root user.
string$query_root_requestIf you want a query to be processed for a root user seperately.
Returns:
mixed
setRoleQuery ( query_request,
query_root_request = false 
)

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.

Parameters:
string$query_requestNormal query to be returned if user is not a root user.
string$query_root_requestIf you want a query to be processed for a root user seperately.
Returns:
mixed
userConfig ( )

Simply writes user session data.

Date:
20110622
Version:
1.1
Author:
Jason Schoeman
userIp ( )

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

Returns:
string

Field Documentation

$groupsArray
$mergeGroups
$mergeRoles
$parentGroups
$rolesArray
$userBelongsToGroupByAlias

The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations