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

Class: LiveUser_Admin_Perm_Container_DB_Simple

Source Location: /LiveUser-0.13.0/Admin/Perm/Container/DB_Simple.php

Class Overview

LiveUser_Admin_Perm_Common
   |
   --LiveUser_Admin_Perm_Container_DB_Simple

Container for simple rights managements.


Author(s):

Version:

  • $Id: DB_Simple.php,v 1.35 2004/08/28 15:46:36 lsmith Exp $

Methods


Child classes:

LiveUser_Admin_Perm_Container_DB_Medium
This is a PEAR::DB admin class for the LiveUser package.

Inherited Variables

Inherited Methods

Class: LiveUser_Admin_Perm_Common

LiveUser_Admin_Perm_Common::LiveUser_Admin_Perm_Common()
Class constructor. Feel free to override in backend subclasses.
LiveUser_Admin_Perm_Common::addRights()
Adds rights for a single user.
LiveUser_Admin_Perm_Common::addUser()
Adds a new user to Perm.
LiveUser_Admin_Perm_Common::getAuthUserId()
Gets the auth ID of a user.
LiveUser_Admin_Perm_Common::getPermUserId()
Gets the perm ID of a user.
LiveUser_Admin_Perm_Common::getProperty()
Function returns the inquired value if it exists in the class.
LiveUser_Admin_Perm_Common::getUsers()
Gets all perm_user_id, type, container and rights
LiveUser_Admin_Perm_Common::outputRightsConstants()
Generate the constants to a file or define them directly.
LiveUser_Admin_Perm_Common::removeRights()
Removes rights for a single user.
LiveUser_Admin_Perm_Common::removeUser()
Removes an existing user from Perm.
LiveUser_Admin_Perm_Common::setUserType()
Updates user type.
LiveUser_Admin_Perm_Common::updateRights()
Shortcut to delete all existing rights of a user and add the given.

Class Details

[line 38]
Container for simple rights managements.

With it you can only assign rights to users. For advanced uses like groups assignements and more see DB_Medium and DB_Complex.



[ Top ]


Method Detail

LiveUser_Admin_Perm_Container_DB_Simple (Constructor)   [line 48]

void LiveUser_Admin_Perm_Container_DB_Simple( array &$connectOptions)

Constructor

Parameters:

array   &$connectOptions   —  full liveuser configuration array

[ Top ]

addApplication   [line 529]

mixed addApplication( [string $define_name = null], [string $application_name = null], [string $application_description = null])

Add an application
  • Return: integer (application_id) or DB Error object
  • Access: public

Parameters:

string   $define_name   —  name of application constant
string   $application_name   —  name of application
string   $application_description   —  description of application

[ Top ]

addArea   [line 580]

mixed addArea( int $applicationId, [string $define_name = null], [string $area_name = null], [string $area_description = null])

Add an area
  • Return: integer (area_id) or DB Error object
  • Access: public

Parameters:

int   $applicationId   —  id of application
string   $define_name   —  name of area constant
string   $area_name   —  name of area
string   $area_description   —  description of area

[ Top ]

addLanguage   [line 380]

mixed addLanguage( string $two_letter_code, string $language_name, [string $language_description = null])

Add a new language
  • Return: integer (language_id) or DB Error object
  • Access: public

Parameters:

string   $two_letter_code   —  two letter code of language
string   $language_name   —  name of language
string   $language_description   —  description of language

[ Top ]

addRight   [line 852]

mixed addRight( integer $areaId, [string $define_name = null], [string $right_name = null], [string $right_description = null])

Add a right in special area
  • Return: integer (right_id) or DB Error object
  • Access: public

Parameters:

integer   $areaId   —  id of area
string   $define_name   —  name of right constant
string   $right_name   —  name of right
string   $right_description   —  description of right

[ Top ]

addTranslation   [line 219]

mixed addTranslation( integer $sectionId, integer $section_type, string $language, string $name, [string $description = null])

Assigns name (and description) in specified language to a section
  • Return: boolean or DB Error object
  • Access: public

Parameters:

integer   $sectionId   —  id of [section]
integer   $section_type   —  type of section
string   $language   —  language (two letter code) of name/description
string   $name   —  name of [section]
string   $description   —  description of [section]

[ Top ]

addUser   [line 995]

mixed addUser( string $authId, $authName, [int $type = LIVEUSER_USER_TYPE_ID], [mixed $permId = null], string $authname)

Add a user
  • Return: string (perm_user_id) or DB Error object
  • Access: public

Overrides LiveUser_Admin_Perm_Common::addUser() (Adds a new user to Perm.)

Parameters:

string   $authId   —  Auth user ID of the user that should be added.
string   $authname   —  Auth container name.
int   $type   —  User type (constants defined in Perm/Common.php) (optional).
mixed   $permId   —  If specificed no new ID will be automatically generated instead
   $authName   — 

[ Top ]

addUserAreaAdmin   [line 1587]

mixed addUserAreaAdmin( mixed $permId, int $areaId)

Make a user an admin of a given area.
  • Return: true on success, DB Error object or false
  • Access: public

Parameters:

mixed   $permId   —  user identifier
int   $areaId   —  area identifier

[ Top ]

getApplications   [line 1251]

mixed getApplications( [array $options = null])

Get list of all applications

This method accepts the following options... 'where_application_id' = [APPLICATION_ID]

  • Return: array or DB Error object
  • Access: public

Parameters:

array   $options   —  an array determining which fields and conditions to use

[ Top ]

getAreas   [line 1302]

mixed getAreas( [array $options = null])

Get list of all areas within a given application

This method accepts the following options... 'where_area_id' = [AREA_ID], 'where_application_id' = [APPLICATION_ID], 'with_applications' = [BOOLEAN]

  • Return: array or DB Error object
  • Access: public

Parameters:

array   $options   —  an array determining which fields and conditions to use

[ Top ]

getAuthUserId   [line 108]

mixed getAuthUserId( string $permId, [ $id_only = false])

Gets the auth ID of a user.
  • Return: Permission ID or DB error.
  • Access: public

Overrides LiveUser_Admin_Perm_Common::getAuthUserId() (Gets the auth ID of a user.)

Parameters:

string   $permId   —  Perm user ID.
   $id_only   — 

[ Top ]

getCurrentApplication   [line 203]

string getCurrentApplication( )

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

[ Top ]

getCurrentLanguage   [line 178]

string getCurrentLanguage( )

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

[ Top ]

getLanguages   [line 1366]

mixed getLanguages( [array $options = null])

Get list of all languages

This method accepts the following options... 'where_language_id' = [LANGUAGE_ID], 'with_translations' = [BOOLEAN]

  • Return: array or DB Error object
  • Access: public

Parameters:

array   $options   —  an array determining which fields and conditions to use

[ Top ]

getPermUserId   [line 85]

mixed getPermUserId( string $authId, string $authName)

Gets the perm ID of a user.
  • Return: Permission ID or DB error.
  • Access: public

Overrides LiveUser_Admin_Perm_Common::getPermUserId() (Gets the perm ID of a user.)

Parameters:

string   $authId   —  Auth user ID.
string   $authName   —  Auth container name.

[ Top ]

getRights   [line 1446]

mixed getRights( [array $options = null])

Get list of all rights

This method accepts the following options... 'where_user_id' = [AUTH_USER_ID], 'where_group_id' = [GROUP_ID], 'where_right_id' = [RIGHT_ID], 'where_area_id' = [AREA_ID], 'where_application_id' = [APPLICATION_ID], 'with_areas' = [BOOLEAN], 'with_applications' = [BOOLEAN]

  • Return: array or DB Error object
  • Access: public

Overridden in child classes as:

LiveUser_Admin_Perm_Container_DB_Complex::getRights()
Get list of all rights

Parameters:

array   $options   —  an array determining which fields and conditions to use

[ Top ]

getTranslation   [line 348]

mixed getTranslation( integer $sectionId, integer $section_type)

Get name (and description) of the [section] in specified language
  • Return: array or DB Error object
  • Access: public

Parameters:

integer   $sectionId   —  id of [section]
integer   $section_type   —  type of section

[ Top ]

getUsers   [line 1662]

mixed getUsers( [array $filters = array()], [boolean $options = array()], [boolean $rekey = false])

Fetch users from the database.

The only supported filter is perm_user_id => 'value'

The array will look like this:

  1.  $userData[0]['perm_user_id'= 1;
  2.              ['type']         = 1;
  3.              ['container']    '';
  4.              ['rights']       = array()// the array returned by getRights()

  • Return: Array with user data or error object.
  • See: LiveUser_Admin_Perm_DB_Common::getRights()
  • Access: public

Overrides LiveUser_Admin_Perm_Common::getUsers() (Gets all perm_user_id, type, container and rights)

Parameters:

array   $filters   —  filters to apply to fetched data
boolean   $options   —  If true the rights for each user will be retrieved.
boolean   $rekey   —  will return an associative array with the auth_user_id as the key by using DB::getAssoc() instead of DB::getAll()

[ Top ]

grantUserRight   [line 1146]

mixed grantUserRight( string $permId, integer $rightId)

Grant right to user
  • Return: boolean or DB Error object
  • Access: public

Overridden in child classes as:

LiveUser_Admin_Perm_Container_DB_Complex::grantUserRight()
Grant right to user

Parameters:

string   $permId   —  id of user
integer   $rightId   —  id of right

[ Top ]

removeApplication   [line 630]

mixed removeApplication( integer $applicationId)

Delete an application
  • Return: boolean or DB Error object or false
  • Access: public

Parameters:

integer   $applicationId   —  id of application

[ Top ]

removeArea   [line 690]

mixed removeArea( integer $areaId)

Delete an area
  • Return: boolean or DB Error object or false
  • Access: public

Parameters:

integer   $areaId   —  id of area

[ Top ]

removeLanguage   [line 441]

mixed removeLanguage( integer $language)

Remove a language
  • Return: boolean or DB Error object
  • Access: public

Parameters:

integer   $language   —  language (two letter code)

[ Top ]

removeRight   [line 903]

boolean removeRight( integer $rightId)

Delete a right
  • Return: true on success or false on failure
  • Access: public

Overridden in child classes as:

LiveUser_Admin_Perm_Container_DB_Medium::removeRight()
Delete a right
LiveUser_Admin_Perm_Container_DB_Complex::removeRight()
Overriden method to delete implied rights mapping as well as the right.

Parameters:

integer   $rightId   —  id of right

[ Top ]

removeTranslation   [line 308]

mixed removeTranslation( integer $sectionId, integer $section_type, string $language, [boolean $recursive = false])

Remove name (and description) of the [section] in specified language
  • Return: boolean or DB Error object
  • Access: public

Parameters:

integer   $sectionId   —  id of [section]
integer   $section_type   —  type of section
string   $language   —  language (two letter code) of name/description
boolean   $recursive   —  recursive delete of all translations

[ Top ]

removeUser   [line 1085]

mixed removeUser( string $permId)

Delete user
  • Return: boolean or DB Error object
  • Access: public

Overridden in child classes as:

LiveUser_Admin_Perm_Container_DB_Complex::removeUser()

Overrides LiveUser_Admin_Perm_Common::removeUser() (Removes an existing user from Perm.)

Parameters:

string   $permId   —  id of user

[ Top ]

removeUserAreaAdmin   [line 1618]

mixed removeUserAreaAdmin( mixed $permId, [int $areaId = null])

Remove the privilege of being an admin.

If no area_id is provided the user will be removed asan admin from all areas he was an admin for.

  • Return: true on success, DB Error object or false
  • Access: public

Parameters:

mixed   $permId   —  user identifier
int   $areaId   —  area identifier

[ Top ]

revokeUserRight   [line 1220]

mixed revokeUserRight( string $permId, [integer $rightId = null])

Revoke right from user
  • Return: boolean or DB Error object
  • Access: public

Parameters:

string   $permId   —  id of user
integer   $rightId   —  id of right

[ Top ]

setCurrentApplication   [line 190]

boolean setCurrentApplication( integer $applicationId)

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

Parameters:

integer   $applicationId   —  id of application

[ Top ]

setCurrentLanguage   [line 155]

mixed setCurrentLanguage( string $language)

Set current language

Returns false if the language is not known

  • Return: boolean or DB Error object or false
  • Access: public

Parameters:

string   $language   —  language short name

[ Top ]

updateApplication   [line 762]

mixed updateApplication( integer $applicationId, [string $define_name = null], [string $application_name = null], [string $application_description = null])

Update an application
  • Return: boolean or DB Error object
  • Access: public

Parameters:

integer   $applicationId   —  id of application
string   $define_name   —  name of application constant
string   $application_name   —  name of application
string   $application_description   —  description of application

[ Top ]

updateArea   [line 806]

mixed updateArea( integer $areaId, int $applicationId, [string $define_name = null], [string $area_name = null], [string $area_description = null])

Update an area
  • Return: boolean or DB Error object or false
  • Access: public

Parameters:

integer   $areaId   —  id of area
int   $applicationId   —  id of application
string   $define_name   —  name of area constant
string   $area_name   —  name of area
string   $area_description   —  description of area

[ Top ]

updateLanguage   [line 488]

mixed updateLanguage( integer $language, string $language_name, [string $language_description = null])

Update language
  • Return: boolean or DB Error object
  • Access: public

Parameters:

integer   $language   —  language (two letter code)
string   $language_name   —  name of language
string   $language_description   —  description of language

[ Top ]

updateRight   [line 951]

mixed updateRight( integer $rightId, integer $areaId, [string $define_name = null], [string $right_name = null], [string $right_description = null])

Update a right
  • Return: boolean or DB Error object
  • Access: public

Parameters:

integer   $rightId   —  id of right
integer   $areaId   —  id of area
string   $define_name   —  name of right constant
string   $right_name   —  name of right
string   $right_description   —  description of right

[ Top ]

updateTranslation   [line 265]

mixed updateTranslation( integer $sectionId, integer $section_type, string $language, string $name, [string $description = null])

Updates name (and description) of [section] in specified language
  • Return: boolean or DB Error object
  • Access: public

Parameters:

integer   $sectionId   —  id of [section]
integer   $section_type   —  type of section
string   $language   —  language (two letter code) of name/description
string   $name   —  name of [section]
string   $description   —  description of [section]

[ Top ]

updateUser   [line 1042]

mixed updateUser( int $permId, [mixed $authId = false], [mixed $authName = false], [mixed $type = false])

Updates auth_user_id in the mapping table.
  • Return: true or DB Error object or false if there was an error to begin with
  • Access: public

Parameters:

int   $permId   —  perm_user_id of the user
mixed   $authId   —  new Auth user ID
mixed   $authName   —  new Auth Container name
mixed   $type   —  new perm type

[ Top ]

updateUserRight   [line 1192]

mixed updateUserRight( string $permId, integer $rightId, integer $right_level)

Update right level of userRight
  • Return: boolean or DB Error object
  • Access: public

Parameters:

string   $permId   —  id of user
integer   $rightId   —  id of right
integer   $right_level   —  right level

[ Top ]


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