Phundament App Class Reference
  • Package
  • Class
  • Tree

Packages

  • bootstrap
    • widgets
      • input
  • Image
  • None
  • p3admin
  • p3extensions
    • behaviors
    • commands
    • components
    • helpers
    • widgets
  • p3media
    • actions
    • controllers
    • models
  • p3pages
    • models
  • p3widgets
    • components
    • models
  • PHP
  • system
    • db
      • ar
    • gii
    • web
      • auth
      • helpers
      • widgets
  • yiiext
    • widgets
      • fancybox
      • lipsum
  • zii
    • widgets
      • grid

Classes

  • ActivationController
  • AdminController
  • AssignmentController
  • AssignmentForm
  • AuthChildForm
  • AuthItemController
  • AuthItemForm
  • BaseP3Widget
  • BaseP3WidgetMeta
  • BaseP3WidgetTranslation
  • Bootstrap
  • CImageComponent
  • CKEditor
  • CodeProvider
  • DefaultController
  • EChosen
  • EDbMigration
  • EditableField
  • EditableSaver
  • EMigrateCommand
  • ESelect2
  • EUserFlash
  • FullCrudFieldProvider
  • GenerateForm
  • IdentificationColumnValidator
  • InstallController
  • JSONEditorView
  • JuiJSONEditorInput
  • LoginController
  • LogoutController
  • Metadata
  • P3CrudFieldProvider
  • P3MediaController
  • P3MediaMetaController
  • P3MediaSelect
  • P3PageController
  • P3PageMetaController
  • P3PageTranslationController
  • P3Widget
  • P3WidgetController
  • P3WidgetMetaController
  • P3WidgetTranslation
  • P3WidgetTranslationController
  • ProfileController
  • ProfileFieldController
  • RAuthItemBehavior
  • RAuthItemChildDataProvider
  • RAuthItemDataProvider
  • RAuthItemParentDataProvider
  • RAuthorizer
  • RController
  • RDbAuthManager
  • RecoveryController
  • RegistrationController
  • RegistrationForm
  • RGenerator
  • Rights
  • RightsFilter
  • RightsModule
  • RInstaller
  • RPermissionDataProvider
  • RUserBehavior
  • RWebUser
  • UActiveForm
  • UploadHandler
  • UserChangePassword
  • UserController
  • UserIdentity
  • UserLogin
  • UserModule
  • UserRecoveryForm
  • UWdropDownDep
  • UWfile
  • UWjuiAutoComplete
  • UWjuidate
  • UWrelBelongsTo
  • WebUserBehavior

Class RAuthorizer

Rights authorizer component class file.

CComponent
Extended by CApplicationComponent implements IApplicationComponent
Extended by RAuthorizer
Copyright: Copyright © 2010 Christoffer Niska
Author: Christoffer Niska <cniska@live.com>
Since: 0.5
Located at crisu83/yii-rights/components/RAuthorizer.php

Methods summary

public
# init( )

Initializes the authorizer.

Initializes the authorizer.

Overrides

CApplicationComponent::init
public the
# getRoles( boolean $includeSuperuser = true, boolean $sort = true )

Returns the a list of all roles.

Returns the a list of all roles.

Parameters

$includeSuperuser
boolean
$includeSuperuser whether to include the superuser.
$sort
boolean
$sort whether to sort the items by their weights.

Returns

the
roles.
public CAuthItem
# createAuthItem( string $name, integer $type, string $description = '', string $bizRule = null, mixed $data = null )

Creates an authorization item.

Creates an authorization item.

Parameters

$name
string
$name the item name. This must be a unique identifier.
$type
integer
$type the item type (0: operation, 1: task, 2: role).
$description
string
$description the description for the item.
$bizRule
string
$bizRule business rule associated with the item. This is a piece of PHP code that will be executed when checkAccess is called for the item.
$data
mixed
$data additional data associated with the item.

Returns

CAuthItem
the authorization item
public
# updateAuthItem( string $oldName, integer $name, string $description = '', string $bizRule = null, mixed $data = null )

Updates an authorization item.

Updates an authorization item.

Parameters

$oldName
string
$oldName the item name. This must be a unique identifier.
$name
integer
$name the item type (0: operation, 1: task, 2: role).
$description
string
$description the description for the item.
$bizRule
string
$bizRule business rule associated with the item. This is a piece of PHP code that will be executed when checkAccess is called for the item.
$data
mixed
$data additional data associated with the item.
public array
# getAuthItems( mixed $types = null, mixed $userId = null, CAuthItem $parent = null, boolean $sort = true, array $exclude = array() )

Returns the authorization items of the specific type and user.

Returns the authorization items of the specific type and user.

Parameters

$types
mixed
$types the item type (0: operation, 1: task, 2: role). Defaults to null, meaning returning all items regardless of their type.
$userId
mixed
$userId the user ID. Defaults to null, meaning returning all items even if they are not assigned to a user.
$parent
CAuthItem
$parent the item for which to get the select options.
$sort
boolean
$sort sort items by to weights.
$exclude
array
$exclude the items to be excluded.

Returns

array
the authorization items of the specific type.
protected array
# mergeAuthItems( array $array1, array $array2 )

Merges two arrays with authorization items preserving the keys.

Merges two arrays with authorization items preserving the keys.

Parameters

$array1
array
$array1 the items to merge to.
$array2
array
$array2 the items to merge from.

Returns

array
the merged items.
protected array
# excludeInvalidAuthItems( array $items, CAuthItem $parent = null, array $exclude = array() )

Excludes invalid authorization items. When an item is provided its parents and children are excluded aswell.

Excludes invalid authorization items. When an item is provided its parents and children are excluded aswell.

Parameters

$items
array
$items the authorization items to process.
$parent
CAuthItem
$parent the item to check valid authorization items for.
$exclude
array
$exclude additional items to be excluded.

Returns

array
valid authorization items.
public array
# getAuthItemParents( mixed $item, integer $type = null, string $parentName = null, boolean $direct = false )

Returns the parents of the specified authorization item.

Returns the parents of the specified authorization item.

Parameters

$item
mixed
$item the item name for which to get its parents.
$type
integer
$type the item type (0: operation, 1: task, 2: role). Defaults to null, meaning returning all items regardless of their type.
$parentName
string
$parentName the name of the item in which permissions to search.
$direct
boolean
$direct whether we want the specified items parent or all parents.

Returns

array
the names of the parent items.
public array
# getAuthItemChildren( mixed $item, integer $type = null )

Returns the children for the specified authorization item recursively.

Returns the children for the specified authorization item recursively.

Parameters

$item
mixed
$item the item for which to get its children.
$type
integer
$type the item type (0: operation, 1: task, 2: role). Defaults to null, meaning returning all items regardless of their type.

Returns

array
the names of the item's children.
public mixed
# attachAuthItemBehavior( mixed $items, integer $userId = null, CAuthItem $parent = null )

Attaches the rights authorization item behavior to the given item.

Attaches the rights authorization item behavior to the given item.

Parameters

$items
mixed
$items the item or items to which attach the behavior.
$userId
integer
$userId the ID of the user to which the item is assigned.
$parent
CAuthItem
$parent the parent of the given item.

Returns

mixed
the item or items with the behavior attached.
public the
# getSuperusers( )

Returns the users with superuser privileges.

Returns the users with superuser privileges.

Returns

the
superusers.
public mixed
# attachUserBehavior( mixed $users )

Attaches the rights user behavior to the given users.

Attaches the rights user behavior to the given users.

Parameters

$users
mixed
$users the user or users to which attach the behavior.

Returns

mixed
the user or users with the behavior attached.
public boolean
# isSuperuser( integer $userId )

Returns whether the user is a superuser.

Returns whether the user is a superuser.

Parameters

$userId
integer
$userId the id of the user to do the check for.

Returns

boolean
whether the user is a superuser.
public the
# getPermissions( string $itemName = null )

Returns the permissions for a specific authorization item.

Returns the permissions for a specific authorization item.

Parameters

$itemName
string
$itemName the name of the item for which to get permissions. Defaults to null, meaning that the full permission tree is returned.

Returns

the
permission tree.
public integer
# hasPermission( string $itemName, string $parentName = null, array $permissions = array() )

Returns the permission type for an authorization item.

Returns the permission type for an authorization item.

Parameters

$itemName
string
$itemName the name of the item to check permission for.
$parentName
string
$parentName the name of the item in which permissions to look.
$permissions
array
$permissions the permissions.

Returns

integer
the permission type (0: None, 1: Direct, 2: Inherited).
protected mixed
# sanitizeExpression( string $code )

Tries to sanitize code to make it safe for execution.

Tries to sanitize code to make it safe for execution.

Parameters

$code
string
$code the code to be execute.

Returns

mixed
the return value of eval() or null if the code was unsafe to execute.
public RAuthManager
# getAuthManager( )

Returns

RAuthManager
the authorization manager.

Methods inherited from CApplicationComponent

getIsInitialized()

Methods inherited from CComponent

__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()

Magic methods summary

Properties summary

public mixed $superuserName
#

Properties inherited from CApplicationComponent

$behaviors

Magic properties inherited from CApplicationComponent

$isInitialized

Phundament App Class Reference API documentation generated by ApiGen 2.8.0