LiveUser
[ class tree: LiveUser ] [ index: LiveUser ] [ all elements ]

Class: LiveUser_Perm_Common

Source Location: /LiveUser-0.13.0/Perm/Common.php

Class Overview


This class provides a set of functions for implementing a user permission management system on live websites. All authorisation backends/containers must be extensions of this base class.


Author(s):

Version:

  • $Id: Common.php,v 1.40 2004/07/22 07:26:26 lsmith Exp $

Variables

Methods


Child classes:

LiveUser_Perm_Container_DB_Simple
Simple DB-based complexity driver for LiveUser.
LiveUser_Perm_Container_MDB_Simple
Simple MDB-based complexity driver for LiveUser.
LiveUser_Perm_Container_MDB2_Simple
Simple MDB2-based complexity driver for LiveUser.
LiveUser_Perm_Container_XML_Simple
Simple XML-based complexity driver for LiveUser.

Inherited Variables

Inherited Methods


Class Details

[line 63]
This class provides a set of functions for implementing a user permission management system on live websites. All authorisation backends/containers must be extensions of this base class.
  • Author: Bjoern Kraus <krausbn@php.net>
  • Author: Markus Wolff <wolff@21st.de>
  • Version: $Id: Common.php,v 1.40 2004/07/22 07:26:26 lsmith Exp $


[ Top ]


Class Variables

$groupIds =  false

[line 117]

Defines the (sub)groups in which the user is a member

Type:   mixed


[ Top ]

$groupRights = array()

[line 103]

Two-dimensional array containing all groups that the user belongs to and the grouprights.

Format: "GroupId" => "RightId" => "Level"


Type:   array


[ Top ]

$ondemand =  false

[line 124]

Defines if the user rights should be retrieved ondemand.

Type:   boolean


[ Top ]

$permUserId =  ''

[line 70]

Unique user ID, used to identify users from the auth container.

Type:   string


[ Top ]

$rights =  false

[line 81]

One-dimensional array containing current user's rights.

This already includes grouprights and possible overrides by individual right settings.

Format: "RightId" => "Level"


Type:   mixed


[ Top ]

$userRights = array()

[line 91]

One-dimensional array containing only the individual rights for the actual user.

Format: "RightId" => "Level"


Type:   array


[ Top ]

$userType =  LIVEUSER_ANONYMOUS_TYPE_ID

[line 110]

Defines the user type.

Type:   integer


[ Top ]



Method Detail

LiveUser_Perm_Common (Constructor)   [line 136]

LiveUser_Perm_Common LiveUser_Perm_Common( )

Class constructor. Feel free to override in backend subclasses.

[ Top ]

checkLevel   [line 347]

boolean checkLevel( integer $level, mixed $owner_user_id, mixed $owner_group_id)

Checks if the current user has a certain right in a given area at the necessary level.

Level 1: requires that owner_user_id matches $this->permUserId Level 2: requires that the $owner_group_id matches the id one of the (sub)groups that $this->permUserId is a memember of or requires that the $owner_user_id matches a perm_user_id of a memeber of one of $this->permUserId's (sub)groups Level 3: no requirements

Important note: Every ressource MAY be owned by a user and/or by a group. Therefore, $owner_user_id and/or $owner_group_id can either be an integer or null.

  • Return: true if the level is sufficient to grant access else false.

Parameters:

integer   $level   —  Level value as returned by checkRight().
mixed   $owner_user_id   —  Id or array of Ids of the owner of the
mixed   $owner_group_id   —  Id or array of Ids of the group of the ressource for which the right is requested.

[ Top ]

checkRight   [line 304]

integer checkRight( integer $right_id, [boolean $ondemand = true])

Checks if the current user has a certain right in a given area.

If $this->ondemand and $ondemand is true, the rights will be loaded on the fly.

  • Return: Level of the right.
  • Access: public

Parameters:

integer   $right_id   —  Id of the right to check for.
boolean   $ondemand   —  allow ondemand reading of rights

[ Top ]

disconnect   [line 180]

void disconnect( )

properly disconnect from resources
  • Access: public

Overridden in child classes as:

LiveUser_Perm_Container_DB_Simple::disconnect()
properly disconnect from resources
LiveUser_Perm_Container_MDB_Simple::disconnect()
properly disconnect from resources
LiveUser_Perm_Container_MDB2_Simple::disconnect()
properly disconnect from resources
LiveUser_Perm_Container_XML_Simple::disconnect()
properly disconnect from resources

[ Top ]

freeze   [line 162]

array freeze( )

store all properties in an array
  • Return: containing the property values
  • Access: public

[ Top ]

getProperty   [line 373]

mixed getProperty( string $what)

Function returns the inquired value if it exists in the class.
  • Return: null, a value or an array.

Parameters:

string   $what   —  Name of the property to be returned.

[ Top ]

getRights   [line 279]

mixed getRights( [boolean $withLevels = false])

Returns a one-dimensional array with all rights assigned

to this user. Array format depends on the optional parameter: true: array(intRight_ID => intRightLevel, ...) false array(intRight_ID, ...) [Default] If no rights are available, false is returned.

  • Access: public

Parameters:

boolean   $withLevels   — 

[ Top ]

init   [line 149]

boolean init( string $uid)

Tries to find the user with the given user ID in the permissions container. Will read all permission data and return true on success.
  • Return: true if init process was successfull else false.
  • Access: public

Overridden in child classes as:

LiveUser_Perm_Container_DB_Simple::init()
Tries to find the user with the given user ID in the permissions container. Will read all permission data and return true on success.
LiveUser_Perm_Container_MDB_Simple::init()
Tries to find the user with the given user ID in the permissions container. Will read all permission data and return true on success.
LiveUser_Perm_Container_MDB2_Simple::init()
Tries to find the user with the given user ID in the permissions container. Will read all permission data and return true on success.
LiveUser_Perm_Container_XML_Simple::init()
Tries to find the user with the given user ID in the permissions container. Will read all permission data and return true on success.

Parameters:

string   $uid   —  User id in the auth container.

[ Top ]

readGroupRights   [line 259]

void readGroupRights( )

Reads all individual rights of current user into a two-dimensional array of this format: "GroupName" => "AreaName" -> "RightName"

Again, this does nothing in the base class. The described functionality must be implemented in a subclass overriding this method.


Overridden in child classes as:

LiveUser_Perm_Container_DB_Medium::readGroupRights()
Reads the group rights and put them in the array
LiveUser_Perm_Container_MDB_Medium::readGroupRights()
Reads the group rights and put them in the array
LiveUser_Perm_Container_MDB2_Medium::readGroupRights()
Reads the group rights and put them in the array

[ Top ]

readRights   [line 210]

void readRights( )

Reads all rights of current user into a two-dimensional associative array, having the area names as the key of the 1st dimension.

Group rights and invididual rights are being merged in the process.


Overridden in child classes as:

LiveUser_Perm_Container_DB_Simple::readRights()
Reads all rights of current user into an associative array.
LiveUser_Perm_Container_MDB_Simple::readRights()
Reads all rights of current user into an associative array.
LiveUser_Perm_Container_MDB2_Simple::readRights()
Reads all rights of current user into an associative array.
LiveUser_Perm_Container_XML_Simple::readRights()
Reads all rights of current user into an associative array.

[ Top ]

readUserRights   [line 226]

void readUserRights( )

Reads all individual rights of current user into a two-dimensional array of this format: AreaName => RightName -> Value

Again, this does nothing in the base class. The described functionality must be implemented in a subclass overriding this method.


Overridden in child classes as:

LiveUser_Perm_Container_DB_Medium::readUserRights()
Reads the user rights and put them in an array
LiveUser_Perm_Container_MDB_Medium::readUserRights()
Reads the user rights and put them in an array
LiveUser_Perm_Container_MDB2_Medium::readUserRights()
Reads the user rights and put them in an array

[ Top ]

unfreeze   [line 192]

void unfreeze( [array $propertyValues = false])

Reinitializes properties
  • Access: public

Parameters:

array   $propertyValues   — 

[ Top ]

userExists   [line 361]

boolean userExists( integer $user_id)

Checks if a user with the given perm_user_id exists in the permission container and returns true on success.
  • Return: true if the id was found, else false.
  • Access: public

Overridden in child classes as:

LiveUser_Perm_Container_DB_Simple::userExists()
Checks if a user with the given perm_user_id exists in the permission container and returns true on success.
LiveUser_Perm_Container_MDB_Simple::userExists()
Checks if a user with the given perm_user_id exists in the permission container and returns true on success.
LiveUser_Perm_Container_MDB2_Simple::userExists()
Checks if a user with the given perm_user_id exists in the permission container and returns true on success.
LiveUser_Perm_Container_XML_Simple::userExists()
Checks if a user with the given perm_user_id exists in the permission container and returns true on success.

Parameters:

integer   $user_id   —  The users id in the permission table.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 13:56:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.