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

Class: LiveUser_Admin_Perm_Simple

Source Location: /LiveUser_Admin-0.4.0/Perm/Simple.php

Class Overview


Simple permission administration class that features support for


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2002-2006 Markus Wolff

Variables

Methods


Child classes:

LiveUser_Admin_Perm_Medium
Medium permission administration class that extends the Simple class with the ability to create, update, remove and assign groups.

Inherited Variables

Inherited Methods


Class Details

[line 89]
Simple permission administration class that features support for

creating, updating, removing and assigning:

  • users
  • rights
  • areas (categorize rights)
  • applications (categorize areas)
  • translations (for rights, areas, applications and groups)
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.



[ Top ]


Class Variables

$selectable_tables = array(
        'getUsers' => array('perm_users', 'userrights', 'rights'),'getRights'=>array('rights','userrights','areas','applications','translations'),'getAreas'=>array('areas','applications','translations'),'getApplications'=>array('applications','translations'),'getTranslations'=>array('translations'),)

[line 113]

Key (method names), with array lists of selectable tables for the given method
  • Access: public

Type:   array


[ Top ]

$stack =  null

[line 97]

Error stack
  • Access: public

Type:   object PEAR_ErrorStack


[ Top ]

$withFieldMethodMap = array(
        'perm_user_id' => 'getUsers',
        'right_id' => 'getRights',
        'area_id' => 'getAreas',
        'application_id' => 'getApplications',
    )

[line 128]

Key (field name), with method names as values to determine what method should be called to get data when the 'with' option is used in a get*() method
  • Access: public

Type:   array


[ Top ]



Method Detail

LiveUser_Admin_Perm_Simple (Constructor)   [line 142]

void LiveUser_Admin_Perm_Simple( )

Constructor
  • Access: protected

[ Top ]

addApplication   [line 403]

int|bool addApplication( array $data)

Add an application
  • Return: false on error, true (or new id) on success
  • Access: public

Parameters:

array   $data     containing atleast the key-value-pairs of all required columns in the applications table

[ Top ]

addArea   [line 336]

int|bool addArea( array $data)

Add an area
  • Return: false on error, true (or new id) on success
  • Access: public

Parameters:

array   $data     containing atleast the key-value-pairs of all required columns in the areas table

[ Top ]

addRight   [line 269]

int|bool addRight( array $data)

Add a right
  • Return: false on error, true (or new id) on success
  • Access: public

Parameters:

array   $data     containing atleast the key-value-pairs of all required columns in the rights table

[ Top ]

addTranslation   [line 554]

int|bool addTranslation( array $data)

Add a translation
  • Return: false on error, true (or new id) on success
  • Access: public

Parameters:

array   $data     containing atleast the key-value-pairs of all required columns in the users table

[ Top ]

addUser   [line 197]

int|bool addUser( array $data)

Add a user
  • Return: false on error, true (or new id) on success
  • Access: public

Parameters:

array   $data     containing atleast the key-value-pairs of all required columns in the perm_users table

[ Top ]

disconnect   [line 1123]

void disconnect( )

properly disconnect from resources
  • Access: public

[ Top ]

getApplications   [line 868]

bool|array getApplications( [array $params = array()])

Fetches applications
  • Return: false on failure or array with selected data
  • Access: public

Parameters:

array   $params     containing key-value pairs for: 'fields' - ordered array containing the fields to fetch if empty all fields from the user table are fetched 'filters' - key values pairs (value may be a string or an array) 'orders' - key value pairs (values 'ASC' or 'DESC') 'rekey' - if set to true, returned array will have the first column as its first dimension 'group' - if set to true and $rekey is set to true, then all values with the same first column will be wrapped in an array 'limit' - number of rows to select 'offset' - first row to select 'select' - determines what query method to use: 'one' -> queryOne, 'row' -> queryRow, 'col' -> queryCol, 'all' ->queryAll (default) 'selectable_tables' - array list of tables that may be joined to in this query, the first element is the root table from which the joins are done

[ Top ]

getAreas   [line 835]

bool|array getAreas( [array $params = array()])

Fetches areas
  • Return: false on failure or array with selected data
  • Access: public

Parameters:

array   $params     containing key-value pairs for: 'fields' - ordered array containing the fields to fetch if empty all fields from the user table are fetched 'filters' - key values pairs (value may be a string or an array) 'orders' - key value pairs (values 'ASC' or 'DESC') 'rekey' - if set to true, returned array will have the first column as its first dimension 'group' - if set to true and $rekey is set to true, then all values with the same first column will be wrapped in an array 'limit' - number of rows to select 'offset' - first row to select 'select' - determines what query method to use: 'one' -> queryOne, 'row' -> queryRow, 'col' -> queryCol, 'all' ->queryAll (default) 'selectable_tables' - array list of tables that may be joined to in this query, the first element is the root table from which the joins are done

[ Top ]

getRights   [line 802]

bool|array getRights( [array $params = array()])

Fetches rights
  • Return: false on failure or array with selected data
  • Access: public

Overridden in child classes as:

LiveUser_Admin_Perm_Medium::getRights()
Fetches rights
LiveUser_Admin_Perm_Complex::getRights()
Fetches rights

Parameters:

array   $params     containing key-value pairs for: 'fields' - ordered array containing the fields to fetch if empty all fields from the user table are fetched 'filters' - key values pairs (value may be a string or an array) 'orders' - key value pairs (values 'ASC' or 'DESC') 'rekey' - if set to true, returned array will have the first column as its first dimension 'group' - if set to true and $rekey is set to true, then all values with the same first column will be wrapped in an array 'limit' - number of rows to select 'offset' - first row to select 'select' - determines what query method to use: 'one' -> queryOne, 'row' -> queryRow, 'col' -> queryCol, 'all' ->queryAll (default) 'selectable_tables' - array list of tables that may be joined to in this query, the first element is the root table from which the joins are done

[ Top ]

getTranslations   [line 901]

bool|array getTranslations( [array $params = array()])

Fetches translations
  • Return: false on failure or array with selected data
  • Access: public

Parameters:

array   $params     containing key-value pairs for: 'fields' - ordered array containing the fields to fetch if empty all fields from the user table are fetched 'filters' - key values pairs (value may be a string or an array) 'orders' - key value pairs (values 'ASC' or 'DESC') 'rekey' - if set to true, returned array will have the first column as its first dimension 'group' - if set to true and $rekey is set to true, then all values with the same first column will be wrapped in an array 'limit' - number of rows to select 'offset' - first row to select 'select' - determines what query method to use: 'one' -> queryOne, 'row' -> queryRow, 'col' -> queryCol, 'all' ->queryAll (default) 'selectable_tables' - array list of tables that may be joined to in this query, the first element is the root table from which the joins are done

[ Top ]

getUsers   [line 769]

bool|array getUsers( [array $params = array()])

Fetches users
  • Return: false on failure or array with selected data
  • Access: public

Parameters:

array   $params     containing key-value pairs for: 'fields' - ordered array containing the fields to fetch if empty all fields from the user table are fetched 'filters' - key values pairs (value may be a string or an array) 'orders' - key value pairs (values 'ASC' or 'DESC') 'rekey' - if set to true, returned array will have the first column as its first dimension 'group' - if set to true and $rekey is set to true, then all values with the same first column will be wrapped in an array 'limit' - number of rows to select 'offset' - first row to select 'select' - determines what query method to use: 'one' -> queryOne, 'row' -> queryRow, 'col' -> queryCol, 'all' ->queryAll (default) 'selectable_tables' - array list of tables that may be joined to in this query, the first element is the root table from which the joins are done

[ Top ]

grantUserRight   [line 478]

void grantUserRight( array $data)

Grant user a right

  1.  // grant user id 13 the right NEWS_CHANGE
  2.  $data = array(
  3.       'right_id'     => NEWS_CHANGE,
  4.       'perm_user_id' => 13
  5.  );
  6.  $lua->perm->grantUserRight($data);

  • Access: public

Parameters:

array   $data     containing the perm_user_id and right_id and optionally a right_level

[ Top ]

init   [line 156]

bool init( array &$conf)

Initialize the storage container
  • Return: true on success or false on failure
  • Access: public

Parameters:

array   &$conf     array containing the configuration.

[ Top ]

outputRightsConstants   [line 947]

bool|array outputRightsConstants( string $type, [array $options = array()], [string $mode = null])

Generate the constants to a file or define them directly.

$type can be either 'constant' or 'array'. Constant will result in defining constants while array results in defining an array.

$options can contain 'prefix' => prefix for the generated (qualified) names 'area' => specific area id to grab rights from 'application' => specific application id to grab rights from 'filters' => specific set of filters to use (overwrites area/application) 'by_group' => if joins should be done using the 'userrights' (false default) or through the 'grouprights' and 'groupusers' tables (true) 'inherited' => filter array to fetch all rights from (sub)group membership 'implied' => filter array for fetching implied rights 'naming' => LIVEUSER_SECTION_RIGHT for PREFIX_RIGHTNAME <- DEFAULT LIVEUSER_SECTION_AREA for PREFIX_AREANAME_RIGHTNAME LIVEUSER_SECTION_APPLICATION for PREFIX_APPLICATIONNAME_AREANAME_RIGHTNAME 'filename' => if $mode is 'file' you must give the full path for the output file 'varname' => if $mode is 'file' and $type is 'array' you must give the name of the variable to define

If no prefix is given it will not be used to generate the constants/arrays

$mode can either be 'file' or 'direct' and will determine of the constants/arrays will be written to a file, or returned/defined. returned as an array when $type is set to 'array' and defined when $type is set to 'constant'

  • Return: depending on the type an array with the data or a boolean denoting success or failure
  • Access: public

Parameters:

string   $type     type of output ('constant' or 'array')
array   $options     options for constants generation
string   $mode     output mode desired ('file' or 'direct')

[ Top ]

removeApplication   [line 440]

int|bool removeApplication( array $filters)

Remove applications and all their relevant relations
  • Return: false on error, the affected rows on success
  • Access: public

Parameters:

array   $filters     key values pairs (value may be a string or an array) This will construct the WHERE clause of your update Be careful, if you leave this blank no WHERE clause will be used and all applications will be affected by the remove

[ Top ]

removeArea   [line 373]

int|bool removeArea( array $filters)

Remove areas and all their relevant relations
  • Return: false on error, the affected rows on success
  • Access: public

Overridden in child classes as:

LiveUser_Admin_Perm_Complex::removeArea()
Remove areas and all their relevant relations

Parameters:

array   $filters     key values pairs (value may be a string or an array) This will construct the WHERE clause of your update Be careful, if you leave this blank no WHERE clause will be used and all areas will be affected by the remove

[ Top ]

removeRight   [line 306]

int|bool removeRight( array $filters)

Remove rights and all their relevant relations
  • Return: false on error, the affected rows on success
  • Access: public

Overridden in child classes as:

LiveUser_Admin_Perm_Medium::removeRight()
Remove rights and all their relevant relations
LiveUser_Admin_Perm_Complex::removeRight()
Remove rights and all their relevant relations

Parameters:

array   $filters     key values pairs (value may be a string or an array) This will construct the WHERE clause of your update Be careful, if you leave this blank no WHERE clause will be used and all rights will be affected by the remove

[ Top ]

removeTranslation   [line 591]

int|bool removeTranslation( array $filters)

Remove translations and all their relevant relations
  • Return: false on error, the affected rows on success
  • Access: public

Parameters:

array   $filters     key values pairs (value may be a string or an array) This will construct the WHERE clause of your update Be careful, if you leave this blank no WHERE clause will be used and all translations will be affected by the remove

[ Top ]

removeUser   [line 239]

int|bool removeUser( array $filters)

Remove users and all their relevant relations
  • Return: false on error, the affected rows on success
  • Access: public

Overridden in child classes as:

LiveUser_Admin_Perm_Medium::removeUser()
Remove users and all their relevant relations

Parameters:

array   $filters     key values pairs (value may be a string or an array) This will construct the WHERE clause of your update Be careful, if you leave this blank no WHERE clause will be used and all users will be affected by the removed

[ Top ]

revokeUserRight   [line 538]

int|bool revokeUserRight( array $filters)

Revoke (remove) right(s) from the user(s)
  • Return: false on error, the affected rows on success
  • Access: public

Parameters:

array   $filters     key values pairs (value may be a string or an array) This will construct the WHERE clause of your update Be careful, if you leave this blank no WHERE clause will be used and all users will be affected by the remove

[ Top ]

updateApplication   [line 422]

int|bool updateApplication( array $data, array $filters)

Update applications
  • Return: false on error, the affected rows on success
  • Access: public

Parameters:

array   $data     containing the key value pairs of columns to update
array   $filters     key values pairs (value may be a string or an array) This will construct the WHERE clause of your update Be careful, if you leave this blank no WHERE clause will be used and all applictions will be affected by the update

[ Top ]

updateArea   [line 355]

int|bool updateArea( array $data, array $filters)

Update areas
  • Return: false on error, the affected rows on success
  • Access: public

Parameters:

array   $data     associative array in the form of $fieldname => $data
array   $filters     associative array in the form of $fieldname => $data This will construct the WHERE clause of your update Be careful, if you leave this blank no WHERE clause will be used and all areas will be affected by the update

[ Top ]

updateRight   [line 288]

int|bool updateRight( array $data, array $filters)

Update rights
  • Return: false on error, the affected rows on success
  • Access: public

Parameters:

array   $data     containing the key value pairs of columns to update
array   $filters     key values pairs (value may be a string or an array) This will construct the WHERE clause of your update Be careful, if you leave this blank no WHERE clause will be used and all rights will be affected by the update

[ Top ]

updateTranslation   [line 573]

int|bool updateTranslation( array $data, array $filters)

Update translations
  • Return: false on error, the affected rows on success
  • Access: public

Parameters:

array   $data     containing the key value pairs of columns to update
array   $filters     key values pairs (value may be a string or an array) This will construct the WHERE clause of your update Be careful, if you leave this blank no WHERE clause will be used and all translations will be affected by the update

[ Top ]

updateUser   [line 221]

int|bool updateUser( array $data, array $filters)

Update users
  • Return: false on error, the affected rows on success
  • Access: public

Parameters:

array   $data     containing the key value pairs of columns to update
array   $filters     key values pairs (value may be a string or an array) This will construct the WHERE clause of your update Be careful, if you leave this blank no WHERE clause will be used and all users will be affected by the update

[ Top ]

updateUserRight   [line 520]

int|bool updateUserRight( array $data, array $filters)

Update right(s) for the given user(s)
  • Return: false on error, the affected rows on success
  • Access: public

Parameters:

array   $data     containing the key value pairs of columns to update
array   $filters     key values pairs (value may be a string or an array) This will construct the WHERE clause of your update Be careful, if you leave this blank no WHERE clause will be used and all users will be affected by the update

[ Top ]


Documentation generated on Tue, 05 Oct 2010 16:30:13 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.