class vB_PermissionContext

Traits

Properties

protected $primary_group_id
protected $secondary_group_ids
protected $infraction_group_ids
protected vB_Datastore $datastore
protected $group_ids
protected $permissions
protected $forumPerms
protected $perms
protected $attachmentPermissions

Methods

__sleep()

No description

__wakeup()

No description

__construct($datastore, $primary_group_id, $secondary_group_ids = array(), $infraction_group_ids = array())

No description

getPermission($group)

No description

getAllChannelAccess(array|integer $usergroups)

This returns an array with the access for each usergroup passed.

rebuildGroupAccess()

This rebuilds the array of channel access by group

array
getModeratorPermissions(int $usergroupid, int $channelid)

Returns array of moderator permissions

array
getPermissions(bool $get_bitmap = TRUE, bool $get_limit = TRUE)

Returns permissions array. This is used for unit testing

isLimitPermission($permission)

No description

array
getUserGroups()

Return an array with usergroups that can provide permissions Extracted from includes/functions.php::cache_permissions

buildBasicPermissions()

Sets the permissions attribute with basic permissions Adapted from includes/functions.php::cache_permissions

boolean
hasPermission(string $group, string $permission)

Does this group have the requested system permissions

getLimit($permission)

No description

array
getForumPerms()

Returns the available permissions

array
getForumAccess(integer $usergroupid)

Returns a list of forums this usergroup can view.

buildPerms()

Build and caches the permissions array

getChannelPermSet($usergroupid, $channelid)

This checks to see if a specific permission has been set for a specific usergroup in a channel

boolean
getChannelPerm(integer $usergroupid, string $permissiongroup, string $permission, int $channelid)

Does the actual bitmap check for a single usergroup in a channel, after we have all the data loaded

clearChannelPermissions(int $usergroupid = false)

Clears all existing permissions. Needed primarily in test.

loadChannelPermissions(int $usergroupid)

This loads a permission group from the database and caches the results

validateInfractionPermissions($usergroupid, $channelid)

No description

static array
getAdminUsergroups($all = true)

Gets any admin usergroups. This is defined as one that can administer permissions

static 
getAdminUser()

Gets an admin user. This is defined as one that can administer the admincp

boolean|array
getAttachmentPermissions($usergroupid, $extension)

Get the attachment limits for an extension and usergroupid. If that usergroup does not have permission or the extension is not in the list of allowed extensions, return false.

clearAttachmentPermissions()

Clear out the attachment permissions.

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 33
__construct($datastore, $primary_group_id, $secondary_group_ids = array(), $infraction_group_ids = array())

Parameters

$datastore
$primary_group_id
$secondary_group_ids
$infraction_group_ids

at line 50
getPermission($group)

Parameters

$group

at line 70
getAllChannelAccess(array|integer $usergroups)

This returns an array with the access for each usergroup passed.

Parameters

array|integer $usergroups -- usergroup ids

@return array on element for each usergroup with the following arrays (each is the
    array of nodeids the user has the appropriate permissons for)
        canview
        canalwaysview
    canaccess
    selfonly
    starteronly
    canseedelnotice
    canpublish

at line 123
rebuildGroupAccess()

This rebuilds the array of channel access by group

This also sets the datastore keys vBUgChannelPermissionsFrom and vBUgChannelAccess

sets datastore values for each group, each datatore entity is an array of channel ids where a user in that group has that access -- canview -- canaccess -- selfonly -- starteronly -- canseedelnotice -- canpublish -- canmoderate

at line 329
array getModeratorPermissions(int $usergroupid, int $channelid)

Returns array of moderator permissions

Parameters

int $usergroupid usergroupid
int $channelid nodeid

Return Value

array array of $key => integer

at line 382
array getPermissions(bool $get_bitmap = TRUE, bool $get_limit = TRUE)

Returns permissions array. This is used for unit testing

Parameters

bool $get_bitmap
bool $get_limit

Return Value

array

at line 407
isLimitPermission($permission)

Parameters

$permission

at line 418
array getUserGroups()

Return an array with usergroups that can provide permissions Extracted from includes/functions.php::cache_permissions

Return Value

array

at line 437
protected buildBasicPermissions()

Sets the permissions attribute with basic permissions Adapted from includes/functions.php::cache_permissions

at line 553
boolean hasPermission(string $group, string $permission)

Does this group have the requested system permissions

Parameters

string $group Permission group the permission is in
string $permission Name of permission

Return Value

boolean

at line 574
getLimit($permission)

Parameters

$permission

at line 593
array getForumPerms()

Returns the available permissions

Return Value

array

at line 609
array getForumAccess(integer $usergroupid)

Returns a list of forums this usergroup can view.

Parameters

integer $usergroupid the usergroup id

Return Value

array an array of 'canRead' and 'cantRead', each an array

at line 636
protected buildPerms()

Build and caches the permissions array

at line 727
getChannelPermSet($usergroupid, $channelid)

This checks to see if a specific permission has been set for a specific usergroup in a channel

Parameters

$usergroupid
$channelid

at line 748
boolean getChannelPerm(integer $usergroupid, string $permissiongroup, string $permission, int $channelid)

Does the actual bitmap check for a single usergroup in a channel, after we have all the data loaded

Parameters

integer $usergroupid the usergroup id
string $permissiongroup the name of the permission group
string $permission the name of the permission
int $channelid the channel to check. Note that we may inherit from a parent.

Return Value

boolean

at line 841
clearChannelPermissions(int $usergroupid = false)

Clears all existing permissions. Needed primarily in test.

Parameters

int $usergroupid (optional)

at line 867
loadChannelPermissions(int $usergroupid)

This loads a permission group from the database and caches the results

Parameters

int $usergroupid

at line 891
protected validateInfractionPermissions($usergroupid, $channelid)

Parameters

$usergroupid
$channelid

at line 932
static array getAdminUsergroups($all = true)

Gets any admin usergroups. This is defined as one that can administer permissions

Parameters

$all

Return Value

array -- user groupids

at line 967
static getAdminUser()

Gets an admin user. This is defined as one that can administer the admincp

return false|integer a userid with admin permissions, false if not found

at line 1053
boolean|array getAttachmentPermissions($usergroupid, $extension)

Get the attachment limits for an extension and usergroupid. If that usergroup does not have permission or the extension is not in the list of allowed extensions, return false.

Note: This is only constrained to the attachmenttype and attachmentpermission tables. The create permissions for all attachments are handled in the channels. TODO: Make this part of the channel permissions

Parameters

$usergroupid
$extension

Return Value

boolean|array false if not enabled for the usergroupid. array of limits if its enabled.

at line 1125
clearAttachmentPermissions()

Clear out the attachment permissions.