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

Class: LiveUser_Admin_Perm_Simple

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

Class Overview


Simple permission administration class that features support for


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2002-2005 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','translations','areas','applications'),'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 ]

$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 413]

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

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

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

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

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

void disconnect( )

properly disconnect from resources
  • Access: public

[ Top ]

getApplications   [line 822]

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)

[ Top ]

getAreas   [line 792]

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)

[ Top ]

getCurrentApplication   [line 399]

string getCurrentApplication( )

Get current application
  • Return: name of the current application
  • Access: public

[ Top ]

getRights   [line 762]

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_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)

[ Top ]

getTranslations   [line 852]

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)

[ Top ]

getUsers   [line 732]

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)

[ Top ]

grantUserRight   [line 484]

void grantUserRight( array $data)

Grant user a right

  1.  // grant user idd 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 155]

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

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 'file' or 'php'. File will write the constant in the given file, replacing/adding constants as needed. Php will call define() function to actually define the constants.

$options can contain 'prefix' => 'prefix_goes_here', 'area' => 'specific area id to grab rights from', 'application' => 'specific application id to grab rights from' '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

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

  • 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 450]

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

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

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

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

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

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 ]

setCurrentApplication   [line 385]

bool setCurrentApplication( int $applicationId)

Set current application
  • Return: always true
  • Access: public

Parameters:

int   $applicationId   —  id of application

[ Top ]

updateApplication   [line 432]

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

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

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

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

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

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 Mon, 11 Mar 2019 14:31:55 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.