Public Member Functions | Public Attributes

Permission Class Reference

Inheritance diagram for Permission:
BEAppModel AppModel

List of all members.

Public Member Functions

 add ($objectId, $perms)
 Add object permissions.
 removeAll ($objectId)
 Remove all object permissions.
 replace ($objectId, $perms)
 Updates/replaces object permissions.
 replaceGroupPerms ($groupId, array $perms)
 remove old permissions on $groupId and add new $perms
 isWritable ($objectId, array &$userData, $perms=array())
 Is object ($objectId) writable by user?
 isForbidden ($objectId, array &$userData)
 Is object ($objectId) forbidden to user? Backend only (check backend_private permission).
 isAccessibleByFrontend ($objectId, array &$userData, $perms=array())
 Is object ($objectId) accessible by user in frontend?
 frontendAccess ($objectId, array &$userData=array())
 Return frontend level access to an object.
 checkPermissionByUser ($perms=array(), array &$userData)
 check if user or user groups are in $perms array
 isPermissionSet ($objectId, $flag)
 check if a permission over an object is set
 remove ($objectId, $perms)
 Delete a permit for an object.
 load ($objectId)
 Load all object permissions.
 countPermissions (array $objects, array $options)
 passed an array of BEdita objects add 'count_permission' key with the number of permissions applied to objects
 relatedObjectsNotAccessibile ($objectId, array $options=array(), array $user=array())
 Return information about frontend not accessible related objects to $objectId.
 isObjectsAndParentsAccessible ($objectId, array $options=array(), array $user=array())
 Return true if object $objectId and its parents are accessible i.e.

Public Attributes

 $belongsTo

Detailed Description

Version:
$Revision$ $LastChangedBy$ $LastChangedDate$

$Id$

Definition at line 31 of file permission.php.


Member Function Documentation

Permission::add ( objectId,
perms 
)

Add object permissions.

Parameters:
integer $objId object id
array $perms array like (array("flag"=>1, "switch" => "group", "name" => "guest"), array(...))

Definition at line 55 of file permission.php.

Referenced by replace().

Permission::checkPermissionByUser ( perms = array(),
array &$  userData 
)

check if user or user groups are in $perms array

Parameters:
$perms permission array like return from find("all) array( 0 => array("Permission" => array(...), "User" => array(...), "Group" => array(...)), 1 => .... )
$userData user data, like array("id" => .., "userid" => ..., "groups" => array("administrator", "frontend",...))
Returns:
boolean (true if user have permission false otherwise)

Definition at line 267 of file permission.php.

Referenced by frontendAccess(), isAccessibleByFrontend(), isForbidden(), and isWritable().

Permission::countPermissions ( array $  objects,
array $  options 
)

passed an array of BEdita objects add 'count_permission' key with the number of permissions applied to objects

Parameters:
array $objects
array $options

  • flag: if specified count permission with that flag
Returns:
array $objects with added 'count_permission' key

Definition at line 367 of file permission.php.

Permission::frontendAccess ( objectId,
array &$  userData = array() 
)

Return frontend level access to an object.

Possible returned values are:

* 'free' if the object has not frontend_access perms * 'denied' if the object isn't accessible (frontend_access_with_block perms set and user groups haven't that permission on that object) * 'partial' if the object is accessible in preview (frontend_access_without_block perms set and user groups haven't that permission on that object) * 'full' if the object has perms and user groups have that permission on that object

Parameters:
int $objectId
array &$userData user data as ``` array( 'id' => .., 'userid' => ..., 'groups' => array('administrator', 'frontend',...) ) ```
Returns:
string

Definition at line 229 of file permission.php.

References checkPermissionByUser(), and isPermissionSet().

Permission::isAccessibleByFrontend ( objectId,
array &$  userData,
perms = array() 
)

Is object ($objectId) accessible by user in frontend?

Parameters:
$objectId 
$userData user data, like array("id" => .., "userid" => ..., "groups" => array("administrator", "frontend",...))
$perms permission array defined like in checkPermissionByUser() call if it's defined use it else get permission by $objectId
Returns:
boolean, true if it's accessible

Definition at line 198 of file permission.php.

References checkPermissionByUser(), and isPermissionSet().

Permission::isForbidden ( objectId,
array &$  userData 
)

Is object ($objectId) forbidden to user? Backend only (check backend_private permission).

Parameters:
integer $objectId
array $userData user data, like array("id" => .., "userid" => ..., "groups" => array("administrator", "frontend",...))
Returns:
boolean, true if it's forbidden false if it's allowed

Definition at line 145 of file permission.php.

References checkPermissionByUser(), and isPermissionSet().

Permission::isObjectsAndParentsAccessible ( objectId,
array $  options = array(),
array $  user = array() 
)

Return true if object $objectId and its parents are accessible i.e.

for $user 'Accessible' means without 'frontend_access_with_block' permission set

$options params are:

  • 'status' the status of parents to check
  • 'area_id' the parents publication id
  • 'stopIfMissingParents' true (default) to stop and return not valid if $objectId haven't parents and it isn't a publication
Parameters:
int $objectId the object id
array $options
array $user the user data
Returns:
boolean

Definition at line 521 of file permission.php.

Permission::isPermissionSet ( objectId,
flag 
)

check if a permission over an object is set

Parameters:
integer $objectId
array|integer $flag permission
Returns:
array of perms with users and groups or false if no permission is setted

Definition at line 289 of file permission.php.

References BeLib::getObject().

Referenced by frontendAccess(), isAccessibleByFrontend(), isForbidden(), and isWritable().

Permission::isWritable ( objectId,
array &$  userData,
perms = array() 
)

Is object ($objectId) writable by user?

Parameters:
integer $objectId
array $userData user data, like array("id" => .., "userid" => ..., "groups" => array("administrator", "frontend",...))
$perms permission array defined like in checkPermissionByUser() call if it's defined use it else get permission by $objectId
Returns:
boolean, true if it's writable

Definition at line 126 of file permission.php.

References checkPermissionByUser(), and isPermissionSet().

Permission::load ( objectId  ) 

Load all object permissions.

Parameters:
integer $objectId
Returns:
array (permissions)

Definition at line 354 of file permission.php.

Permission::relatedObjectsNotAccessibile ( objectId,
array $  options = array(),
array $  user = array() 
)

Return information about frontend not accessible related objects to $objectId.

If $options['count'] = false (default) it returns a list of object ids with permission 'frontend_access_with_block' related to main object $objectId. Passing also $options['relation'] it filters by relation name

If $options['count'] = true it returns an array of count of objects with permission 'frontend_access_with_block' related to main object $objectId and grouped by relation name

Example: ``` array( 'attach' => 14, 'seealso' => 7 ) ```

If $user['groups'] is specified then it tests related objects against user groups and return a list without objects allowed to user or a count of objects not allowed to user

Parameters:
int $objectId the main object id
string $relation the relation name
array $user the user data on which check perms
Returns:
array

Definition at line 406 of file permission.php.

Permission::remove ( objectId,
perms 
)

Delete a permit for an object.

Parameters:
integer $id object ID
array $perms array like (array("flag"=>1, "switch" => "group", "name" => "guest"), array(...))

Definition at line 329 of file permission.php.

Permission::removeAll ( objectId  ) 

Remove all object permissions.

Parameters:
integer $objectId object ID

Definition at line 79 of file permission.php.

Referenced by replace().

Permission::replace ( objectId,
perms 
)

Updates/replaces object permissions.

Parameters:
integer $objId object id
array $perms array like (array("flag"=>1, "switch" => "group", "name" => "guest"), array(...))

Definition at line 90 of file permission.php.

References add(), and removeAll().

Permission::replaceGroupPerms ( groupId,
array $  perms 
)

remove old permissions on $groupId and add new $perms

Parameters:
int $groupId
array $perms array like (array("flag"=> 1, "object_id"), array(...))

Definition at line 102 of file permission.php.


Member Data Documentation

Permission::$belongsTo
Initial value:
 array(
        'User' =>
            array(
                'className'     => 'User',
                'conditions'    => "Permission.switch = 'user' ",
                'foreignKey'    => 'ugid'
            ),
        'Group' =>
            array(
                'className'     => 'Group',
                'conditions'    => "Permission.switch = 'group' ",
                'foreignKey'    => 'ugid'
            ),
    )

Definition at line 34 of file permission.php.


The documentation for this class was generated from the following file:
Generated on Fri Dec 11 2015 15:29:47 by Doxygen 1.7.1  BEditaBEdita 3.7 Corylus