vB_PermissionContext
in package
Uses
vB_Trait_NoSerialize
Table of Contents
- $attachmentPermissions : mixed
- $datastore : vB_Datastore
- $forumPerms : mixed
- $group_ids : mixed
- $infraction_group_ids : mixed
- $permissions : mixed
- $perms : mixed
- $primary_group_id : mixed
- $secondary_group_ids : mixed
- __construct() : mixed
- __serialize() : mixed
- __sleep() : mixed
- __unserialize() : mixed
- __wakeup() : mixed
- clearAttachmentPermissions() : mixed
- Clear out the attachment permissions.
- clearChannelPermissions() : mixed
- Clears all existing permissions. Needed primarily in test.
- getAdminUser() : mixed
- Gets an admin user. This is defined as one that can administer the admincp
- getAdminUsergroups() : array<string|int, mixed>
- Gets any admin usergroups. This is defined as one that can administer permissions
- getAllChannelAccess() : mixed
- This returns an array with the access for each usergroup passed.
- getAttachmentPermissions() : bool|array<string|int, mixed>
- 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.
- getChannelPerm() : bool
- Does the actual bitmap check for a single usergroup in a channel, after we have all the data loaded
- getChannelPermSet() : mixed
- This checks to see if a specific permission has been set for a specific usergroup in a channel
- getForumAccess() : array<string|int, mixed>
- Returns a list of forums this usergroup can view.
- getForumPerms() : array<string|int, mixed>
- Returns the available permissions
- getLimit() : mixed
- getModeratorPermissions() : array<string|int, mixed>
- Returns array of moderator permissions
- getPermission() : mixed
- getPermissions() : array<string|int, mixed>
- Returns permissions array. This is used for unit testing
- getUserGroups() : array<string|int, mixed>
- Return an array with usergroups that can provide permissions Extracted from includes/functions.php::cache_permissions
- hasPermission() : bool
- Does this group have the requested system permissions
- isLimitPermission() : mixed
- loadChannelPermissions() : mixed
- This loads a permission group from the database and caches the results
- rebuildGroupAccess() : mixed
- This rebuilds the array of channel access by group
- buildBasicPermissions() : mixed
- Sets the permissions attribute with basic permissions Adapted from includes/functions.php::cache_permissions
- buildPerms() : mixed
- Build and caches the permissions array
- validateInfractionPermissions() : mixed
- getPermFrom() : mixed
- Helper function to fill in permFrom for the channels that inherit permissions.
Properties
$attachmentPermissions
protected
mixed
$attachmentPermissions
= array()
$datastore
protected
vB_Datastore
$datastore
$forumPerms
protected
mixed
$forumPerms
= alse
$group_ids
protected
mixed
$group_ids
=
ull
$infraction_group_ids
protected
mixed
$infraction_group_ids
$permissions
protected
mixed
$permissions
=
ull
$perms
protected
mixed
$perms
= array()
$primary_group_id
protected
mixed
$primary_group_id
$secondary_group_ids
protected
mixed
$secondary_group_ids
Methods
__construct()
public
__construct(mixed $datastore, mixed $primary_group_id[, mixed $secondary_group_ids = array() ][, mixed $infraction_group_ids = array() ]) : mixed
Parameters
- $datastore : mixed
- $primary_group_id : mixed
- $secondary_group_ids : mixed = array()
- $infraction_group_ids : mixed = array()
Return values
mixed —__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 —clearAttachmentPermissions()
Clear out the attachment permissions.
public
clearAttachmentPermissions() : mixed
Return values
mixed —clearChannelPermissions()
Clears all existing permissions. Needed primarily in test.
public
clearChannelPermissions([int $usergroupid = false ]) : mixed
Parameters
- $usergroupid : int = false
-
(optional)
Return values
mixed —getAdminUser()
Gets an admin user. This is defined as one that can administer the admincp
public
static getAdminUser() : mixed
return false|integer a userid with admin permissions, false if not found
Return values
mixed —getAdminUsergroups()
Gets any admin usergroups. This is defined as one that can administer permissions
public
static getAdminUsergroups([mixed $all = true ]) : array<string|int, mixed>
Parameters
- $all : mixed = true
Return values
array<string|int, mixed> —-- user groupids
getAllChannelAccess()
This returns an array with the access for each usergroup passed.
public
getAllChannelAccess(array<string|int, mixed>|int $usergroups) : mixed
Parameters
- $usergroups : array<string|int, mixed>|int
-
-- 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
Return values
mixed —getAttachmentPermissions()
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.
public
getAttachmentPermissions(mixed $usergroupid, mixed $extension) : bool|array<string|int, mixed>
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 : mixed
- $extension : mixed
Return values
bool|array<string|int, mixed> —false if not enabled for the usergroupid. array of limits if its enabled.
getChannelPerm()
Does the actual bitmap check for a single usergroup in a channel, after we have all the data loaded
public
getChannelPerm(mixed $usergroupid, mixed $permissiongroup, mixed $permission, mixed $channelid) : bool
Parameters
- $usergroupid : mixed
- $permissiongroup : mixed
- $permission : mixed
- $channelid : mixed
Return values
bool —getChannelPermSet()
This checks to see if a specific permission has been set for a specific usergroup in a channel
public
getChannelPermSet(int $usergroupid, mixed $channelid) : mixed
Parameters
- $usergroupid : int
-
@param int $channelid
- $channelid : mixed
Return values
mixed —getForumAccess()
Returns a list of forums this usergroup can view.
public
getForumAccess(mixed $usergroupid) : array<string|int, mixed>
Parameters
- $usergroupid : mixed
Return values
array<string|int, mixed> —an array of 'canRead' and 'cantRead', each an array
getForumPerms()
Returns the available permissions
public
getForumPerms() : array<string|int, mixed>
Return values
array<string|int, mixed> —getLimit()
public
getLimit(mixed $permission) : mixed
Parameters
- $permission : mixed
Return values
mixed —getModeratorPermissions()
Returns array of moderator permissions
public
getModeratorPermissions(mixed $usergroupid, mixed $channelid) : array<string|int, mixed>
Parameters
- $usergroupid : mixed
- $channelid : mixed
Return values
array<string|int, mixed> —array of $key => integer
getPermission()
public
getPermission(mixed $group) : mixed
Parameters
- $group : mixed
Return values
mixed —getPermissions()
Returns permissions array. This is used for unit testing
public
getPermissions([bool $get_bitmap = TRUE ][, bool $get_limit = TRUE ]) : array<string|int, mixed>
Parameters
- $get_bitmap : bool = TRUE
- $get_limit : bool = TRUE
Return values
array<string|int, mixed> —getUserGroups()
Return an array with usergroups that can provide permissions Extracted from includes/functions.php::cache_permissions
public
getUserGroups() : array<string|int, mixed>
Return values
array<string|int, mixed> —hasPermission()
Does this group have the requested system permissions
public
hasPermission(string $group, string $permission) : bool
Parameters
- $group : string
-
Permission group the permission is in
- $permission : string
-
Name of permission
Return values
bool —isLimitPermission()
public
isLimitPermission(mixed $permission) : mixed
Parameters
- $permission : mixed
Return values
mixed —loadChannelPermissions()
This loads a permission group from the database and caches the results
public
loadChannelPermissions(int $usergroupid) : mixed
Parameters
- $usergroupid : int
Return values
mixed —rebuildGroupAccess()
This rebuilds the array of channel access by group
public
rebuildGroupAccess() : mixed
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
Return values
mixed —buildBasicPermissions()
Sets the permissions attribute with basic permissions Adapted from includes/functions.php::cache_permissions
protected
buildBasicPermissions() : mixed
Return values
mixed —buildPerms()
Build and caches the permissions array
protected
buildPerms() : mixed
Return values
mixed —validateInfractionPermissions()
protected
validateInfractionPermissions(mixed $usergroupid, mixed $channelid) : mixed
Parameters
- $usergroupid : mixed
- $channelid : mixed
Return values
mixed —getPermFrom()
Helper function to fill in permFrom for the channels that inherit permissions.
private
getPermFrom(mixed &$permFrom, mixed $channelPerms, mixed $channelParents, mixed $_groupid, mixed $_channelid) : mixed
Returns known permFrom & fills in the gaps as it processes unknowns.
Parameters
- $permFrom : mixed
- $channelPerms : mixed
- $channelParents : mixed
- $_groupid : mixed
- $_channelid : mixed