vB_ChannelPermission
in package
Uses
vB_Trait_NoSerialize
Channel Permissions interface Provides methods used in admincp to read and set channel- specific permissions.
Tags
Table of Contents
- TYPE_BITMAP = 1
- TYPE_BOOL = 4
- TYPE_COUNT = 3
- TYPE_HOURS = 2
- $bitfieldGroup : mixed
- $bitfieldsUsed : mixed
- $defaultPermissions : mixed
- $instance : mixed
- $permissionFields : mixed
- $permissionPhrases : mixed
- $permSettings : mixed
- $usergroups : mixed
- __serialize() : mixed
- __sleep() : mixed
- __unserialize() : mixed
- __wakeup() : mixed
- buildDefaultChannelPermsDatastore() : mixed
- compareDefaultChannelPermissions() : bool
- Compare current channel permissions with default ones.
- deletePerms() : mixed
- this deletes an existing permission
- fetchPermById() : mixed
- this returns a permission setting by permissionid
- fetchPermFields() : mixed
- this returns the fields and types.
- fetchPermissions() : mixed
- this returns a specific permission setting
- fetchPermPhrases() : mixed
- this returns the fields and types.
- fetchPermSettings() : mixed
- this returns the basic settings array.
- instance() : vB_ChannelPermission
- Returns singleton instance of self.
- loadDefaultChannelPermissions() : array<string|int, mixed>
- Load default channel permissions
- setPermissions() : mixed
- this sets permissions for a node and group.
- __construct() : mixed
- formatPermissions() : mixed
- this formats the result of a query
Constants
TYPE_BITMAP
public
mixed
TYPE_BITMAP
= 1
TYPE_BOOL
public
mixed
TYPE_BOOL
= 4
TYPE_COUNT
public
mixed
TYPE_COUNT
= 3
TYPE_HOURS
public
mixed
TYPE_HOURS
= 2
Properties
$bitfieldGroup
protected
static mixed
$bitfieldGroup
= array('forumpermissions' => 'bf_ugp', 'forumpermissions2' => 'bf_ugp', 'moderatorpermissions' => 'misc', 'createpermissions' => 'bf_ugp')
$bitfieldsUsed
protected
static mixed
$bitfieldsUsed
= array('forumpermissions' => array(
'candeletetagown',
'cangetattachment',
'canmove',
'canpostnew',
'canreply',
'canpostattachment',
'cantagothers',
'cantagown',
'canopenclose',
'canview',
'maxattachments',
'canvote',
'canviewothers',
'canviewthreads',
'caneditpost',
'candeletepost',
'candeletethread',
'canseedelnotice',
'canjoin',
// 'followforummoderation',
'canuploadchannelicon',
'cananimatedchannelicon',
'canattachmentcss',
), 'forumpermissions2' => array('canalwaysview', 'canalwayspost', 'canalwayspostnew', 'canconfigchannel', 'canusehtml', 'canpublish', 'canmanageownchannels', 'exemptfromspamcheck', 'candeletechannel', 'cancomment', 'caneditothers', 'candeleteothers', 'cangetimgattachment', 'skipmoderatetopics', 'skipmoderatereplies', 'skipmoderateattach'), 'moderatorpermissions' => array(
'canaddowners',
// 'canbanusers',
'caneditposts',
'canopenclose',
'canmanagethreads',
'canannounce',
'canmoderateattachments',
'canmoderateposts',
'canmoderatetags',
'canremoveposts',
'cansetfeatured',
'canmassmove',
'canviewips',
'candeleteposts',
))
$defaultPermissions
protected
mixed
$defaultPermissions
= array()
$instance
protected
static mixed
$instance
$permissionFields
protected
static mixed
$permissionFields
= array('forumpermissions' => self::TYPE_BITMAP, 'forumpermissions2' => self::TYPE_BITMAP, 'moderatorpermissions' => self::TYPE_BITMAP, 'createpermissions' => self::TYPE_BITMAP, 'edit_time' => self::TYPE_HOURS, 'maxtags' => self::TYPE_COUNT, 'maxstartertags' => self::TYPE_COUNT, 'maxothertags' => self::TYPE_COUNT, 'maxattachments' => self::TYPE_COUNT, 'maxchannels' => self::TYPE_COUNT, 'channeliconmaxsize' => self::TYPE_COUNT)
$permissionPhrases
protected
static mixed
$permissionPhrases
= array('forumpermissions' => 'channel_permissions_gcppermission', 'forumpermissions2' => 'channel_permissions_gcppermission', 'moderatorpermissions' => 'moderator_permissions', 'createpermissions' => 'create_permissions', 'edit_time' => 'edit_time_limit', 'maxtags' => 'max_tags', 'maxstartertags' => 'max_starter_tags', 'maxothertags' => 'max_other_tags', 'maxattachments' => 'max_attachments', 'maxchannels' => 'max_channels', 'channeliconmaxsize' => 'channel_icon_max_size')
$permSettings
protected
mixed
$permSettings
$usergroups
protected
static mixed
$usergroups
Methods
__serialize()
public
__serialize() : mixed
Return values
mixed —__sleep()
public
__sleep() : mixed
Return values
mixed —__unserialize()
public
__unserialize(mixed $serialized) : mixed
Parameters
- $serialized : mixed
Return values
mixed —__wakeup()
public
__wakeup() : mixed
Return values
mixed —buildDefaultChannelPermsDatastore()
public
buildDefaultChannelPermsDatastore() : mixed
Return values
mixed —compareDefaultChannelPermissions()
Compare current channel permissions with default ones.
public
static compareDefaultChannelPermissions( $nodeid, $groupid[, array<string|int, mixed> $currentpermissioncache = array() ]) : bool
Parameters
- $nodeid :
-
int Node ID
- $groupid :
-
int Group ID
- $currentpermissioncache : array<string|int, mixed> = array()
-
If set the function won't try to load
Return values
bool —If current permissions are modified, return true. Otherwise false.
deletePerms()
this deletes an existing permission
public
deletePerms(mixed $params) : mixed
@return mixed either permissionid(single or array), or nodeid and usergroupid.
A single Nodeid is required and usergroup is optional and may be an array
Parameters
- $params : mixed
Return values
mixed —fetchPermById()
this returns a permission setting by permissionid
public
fetchPermById(mixed $permissionid) : mixed
@param integer the permissionid
Parameters
- $permissionid : mixed
Return values
mixed —array of $groupid => array(permission fields). Empty array if no permissions set for that node.
fetchPermFields()
this returns the fields and types.
public
static fetchPermFields() : mixed
@return mixed the $permissionFields array
Return values
mixed —fetchPermissions()
this returns a specific permission setting
public
fetchPermissions(mixed $nodeid[, mixed $groupid = false ]) : mixed
@param integer the node for which we are checking permissions
Parameters
- $nodeid : mixed
- $groupid : mixed = false
Return values
mixed —fetchPermPhrases()
this returns the fields and types.
public
static fetchPermPhrases() : mixed
@return mixed the $permissionFields array
Return values
mixed —fetchPermSettings()
this returns the basic settings array.
public
fetchPermSettings() : mixed
@return mixed the permSettings array
Return values
mixed —instance()
Returns singleton instance of self.
public
static instance() : vB_ChannelPermission
Return values
vB_ChannelPermission —- Reference to singleton instance of the type handler
loadDefaultChannelPermissions()
Load default channel permissions
public
static loadDefaultChannelPermissions( $nodeid, $groupid) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —Channel permissions
setPermissions()
this sets permissions for a node and group.
public
setPermissions(mixed $nodeid, mixed $groupid, mixed $permissions[, mixed $updatedefault = false ]) : mixed
@param integer the node for which we are setting permissions
Parameters
- $nodeid : mixed
- $groupid : mixed
- $permissions : mixed
- $updatedefault : mixed = false
Return values
mixed —__construct()
protected
__construct() : mixed
Return values
mixed —formatPermissions()
this formats the result of a query
protected
formatPermissions(mixed $permissions) : mixed
@param mixed a query result object
Parameters
- $permissions : mixed
Return values
mixed —array of $groupid => array(permission fields). Empty array if no permissions set for that node.