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

Class: LiveUser_Perm_Common

Source Location: /LiveUser-0.12.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.37 2004/06/15 13:28:09 lsmith Exp $

Variables

Methods


Child classes:

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

Inherited Variables

Inherited Methods


Class Details

[line 62]
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.

Usertypes

  • Author: Bjoern Kraus <krausbn@php.net>
  • Author: Markus Wolff <wolff@21st.de>
  • Version: $Id: Common.php,v 1.37 2004/06/15 13:28:09 lsmith Exp $


[ Top ]


Class Variables

$groupIds =  false

[line 116]

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

Usertypes


Type:   integer


[ Top ]

$groupRights = array()

[line 102]

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

Usertypes

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


Type:   integer


[ Top ]

$ondemand =  false

[line 123]

Defines if the user rights should be retrieved ondemand.

Usertypes


Type:   integer


[ Top ]

$permUserId =  ''

[line 69]

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

Usertypes


Type:   integer


[ Top ]

$rights =  false

[line 80]

One-dimensional array containing current user's rights.

Usertypes

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

Format: "RightId" => "Level"


Type:   integer


[ Top ]

$userRights = array()

[line 90]

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

Usertypes

Format: "RightId" => "Level"


Type:   integer


[ Top ]

$userType =  LIVEUSER_ANONYMOUS_TYPE_ID

[line 109]

Defines the user type.

Usertypes


Type:   integer


[ Top ]



Method Detail

LiveUser_Perm_Common (Constructor)   [line 128]

LiveUser_Perm_Common LiveUser_Perm_Common( )

Class constructor. Feel free to override in backend subclasses.

Usertypes


[ Top ]

checkLevel   [line 327]

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.

Usertypes

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 284]

integer checkRight( integer $right_id)

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

Usertypes

If $this->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.

[ Top ]

disconnect   [line 171]

void disconnect( )

properly disconnect from resources

Usertypes

  • Access: public

Overridden in child classes as:

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

[ Top ]

freeze   [line 153]

array freeze( )

store all properties in an array

Usertypes

  • Return: containing the property values
  • Access: public

[ Top ]

getProperty   [line 353]

mixed getProperty( string $what)

Function returns the inquired value if it exists in the class.

Usertypes

  • Return: null, a value or an array.

Parameters:

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

[ Top ]

getRights   [line 261]

mixed getRights( [boolean $withLevels = false])

Returns a one-dimensional array with all rights assigned

Usertypes

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 141]

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.

Usertypes

  • Return: true if init process was successfull else false.
  • Access: public

Overridden in child classes as:

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

Parameters:

string   $uid   —  User id in the auth container.

[ Top ]

readGroupRights   [line 243]

void readGroupRights( )

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

Usertypes

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_MDB2_Medium::readGroupRights()
Reads the group rights and put them in the array
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

[ Top ]

readRights   [line 199]

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.

Usertypes

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


Overridden in child classes as:

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

[ Top ]

readUserRights   [line 214]

void readUserRights( )

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

Usertypes

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_MDB2_Medium::readUserRights()
Reads the user rights and put them in an array
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

[ Top ]

unfreeze   [line 181]

void unfreeze( [array $propertyValues = false])

Reinitializes properties

Usertypes

  • Access: public

Parameters:

array   $propertyValues   — 

[ Top ]

userExists   [line 341]

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.

Usertypes

  • Return: true if the id was found, else false.
  • Access: public

Overridden in child classes as:

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

Parameters:

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

[ Top ]


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