vBulletin v6.0.4

vB_UserContext
in package
Uses vB_Trait_NoSerialize

vB_UserContext

Table of Contents

Constants

USERGROUP_GUESTS  = 1
USERLEVEL_ADMIN  = 4
USERLEVEL_GUEST  = 0
USERLEVEL_MODERATOR  = 2
USERLEVEL_REGUSER  = 1
USERLEVEL_SUPERADMIN  = 5
USERLEVEL_SUPERMODERATOR  = 3

Methods

__construct()  : mixed
Constructor
__serialize()  : array<string|int, mixed>
__sleep()  : array<string|int, mixed>
__unserialize()  : void
__wakeup()  : void
canContribute()  : mixed
Returns true if current user has canpostnew under specified channel
canUpload()  : mixed
Checks to see if a user can upload a file for attachment
clearChannelPermissions()  : mixed
Clears all existing permissions. Needed primarily in test.
fetchGroupInTopic()  : mixed
Fetch group in topic
fetchPermsForChannels()  : mixed
Fetches an array of permissions for a list of channels, which will be passed in slightly adjusted form to the getFullContent methods
fetchUserGroups()  : mixed
Return the usergroups for this user
fetchUserId()  : int
Get the userid
getAllChannelAccess()  : mixed
This returns an array with the access for this user, reflecting usergroup and groupintopic permissions.
getAttachmentPermissions()  : mixed
Check for attachment limits/permissions for a given extension.
getBitfield()  : mixed
getCanCreate()  : mixed
Lists the content types the current user can create at a node.
getCanCreateFalse()  : mixed
Returns the fields from getCanCreate with all permissions set to 0 (false)
getCanModerate()  : mixed
This returns a list of channels where this user can moderate, and an array where they can't.
getChannelLimitPermission()  : int
Checks for a specific permission in a specific channel
getChannelLimits()  : mixed
This returns the 5 limit-type settings at the channel level- edit_time, maxstartertags, maxothertags and maxtags
getChannelPermission()  : bool|int
Checks for a specific permission in a specific channel
getLimit()  : mixed
Checks for a limit-type permission- e.g. maximum number of images.
getModeratorPerms()  : mixed
This returns an array of moderator or moderator-like permissions
getPermissionsFrom()  : int
This function finds where permissions are set for a given node.
getUsergroupLimit()  : mixed
Checks for a limit-type permission in the usergroup table- e.g. maximum number of images.
getUserLevel()  : mixed
Gets user hierarchy level It is used when ignoring a user, the hierarchy is as follows (VBV-1503):
hasAdminPermission()  : bool
Checks the administrator table for individual administrator permission (all the different areas of the admin cp that they can access)
hasModeratorPermission()  : mixed
hasPermission()  : bool
Checks for a specific usergroup permission
isAdministrator()  : bool
Returns whether the user is administrator Adapted from adminfunctions.php::can_administer
isForumModerator()  : mixed
isGloballyIgnored()  : bool
Returns whether the user is globally ignored
isModerator()  : mixed
isSuperAdmin()  : bool
check whether current user is super admin. Don't allow request for a different user.
isSuperMod()  : bool
Returns whether the current user is a super moderator
rebuildGroupAccess()  : mixed
Convenience- since userContext is available everywhere, this calls permissionContext->public rebuildGroupAccess
reloadGroupInTopic()  : mixed
Reloads the groupInTopic data. Needed primarily in test.
reloadUserPerms()  : mixed
Initializes the user context with the permissions for the selected user.

Constants

USERLEVEL_MODERATOR

public mixed USERLEVEL_MODERATOR = 2

USERLEVEL_REGUSER

public mixed USERLEVEL_REGUSER = 1

USERLEVEL_SUPERADMIN

public mixed USERLEVEL_SUPERADMIN = 5

USERLEVEL_SUPERMODERATOR

public mixed USERLEVEL_SUPERMODERATOR = 3

Methods

__construct()

Constructor

public __construct( $userid,  $assertor,  $datastore,  $config) : mixed
Parameters
$userid :

-- if the user is invalid guest user permissions (userid 0) will be used instead

$assertor :
$datastore :
$config :

__serialize()

public __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__sleep()

public __sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>

__unserialize()

public __unserialize(array<string|int, mixed> $serialized) : void
Parameters
$serialized : array<string|int, mixed>

canContribute()

Returns true if current user has canpostnew under specified channel

public canContribute(mixed $channelid) : mixed
Parameters
$channelid : mixed

canUpload()

Checks to see if a user can upload a file for attachment

public canUpload(mixed $size, mixed $extension[, mixed $nodeid = false ]) : mixed
Parameters
$size : mixed
$extension : mixed
$nodeid : mixed = false

clearChannelPermissions()

Clears all existing permissions. Needed primarily in test.

public clearChannelPermissions([mixed $usergroupid = false ]) : mixed
Parameters
$usergroupid : mixed = false

fetchGroupInTopic()

Fetch group in topic

public fetchGroupInTopic([mixed $nodeid = null ]) : mixed
Parameters
$nodeid : mixed = null

fetchPermsForChannels()

Fetches an array of permissions for a list of channels, which will be passed in slightly adjusted form to the getFullContent methods

public fetchPermsForChannels(mixed $channels) : mixed
@param	mixed	array of integers
Parameters
$channels : mixed
Return values
mixed

array of permission. parentid => permissions. permissions are either 0/1 or array of string => 0/1

fetchUserGroups()

Return the usergroups for this user

public fetchUserGroups() : mixed
Return values
mixed

array of usergroupid's

fetchUserId()

Get the userid

public fetchUserId() : int
Return values
int

getAllChannelAccess()

This returns an array with the access for this user, reflecting usergroup and groupintopic permissions.

public getAllChannelAccess() : mixed

$param boolean whether to force reload

Return values
mixed

Each element contains three arrays: canview, canaccess, and selfonly. Each is an array of nodeids where the user has that access

getAttachmentPermissions()

Check for attachment limits/permissions for a given extension.

public getAttachmentPermissions(mixed $extension[, mixed $nodeid = false ]) : mixed

Note: This is only constrained to the attachmenttype and attachmentpermission tables. The create permissions for all attachments are handled in the channels.

Parameters
$extension : mixed
$nodeid : mixed = false
Return values
mixed

false if the extension is not allowed or the user doesn't have permission to use it. Otherwise an array of limits.

getBitfield()

public getBitfield(mixed $permissiongroup) : mixed
Parameters
$permissiongroup : mixed

getCanCreate()

Lists the content types the current user can create at a node.

public getCanCreate(mixed $nodeid) : mixed
Parameters
$nodeid : mixed
Return values
mixed

array of contenttypes

getCanCreateFalse()

Returns the fields from getCanCreate with all permissions set to 0 (false)

public getCanCreateFalse() : mixed

Intended to allow quick creation of the create array when we know no permission are allowed while ensuring that all of the expected array keys are set so that consumers of the permissions don't have to constantly inspect to ensure that type/structure is correct.

getCanModerate()

This returns a list of channels where this user can moderate, and an array where they can't.

public getCanModerate() : mixed
Return values
mixed

array of ('can'=> array of integers, 'cannot' => array of integers)

getChannelLimitPermission()

Checks for a specific permission in a specific channel

public getChannelLimitPermission(mixed $permissiongroup, mixed $permission, mixed $nodeid[, mixed $parents = false ][, mixed $parentid = false ]) : int
Parameters
$permissiongroup : mixed
$permission : mixed
$nodeid : mixed
$parents : mixed = false
$parentid : mixed = false
Return values
int

permission numeric value

getChannelLimits()

This returns the 5 limit-type settings at the channel level- edit_time, maxstartertags, maxothertags and maxtags

public getChannelLimits(mixed $nodeid[, mixed $permission = '' ][, mixed $parents = false ]) : mixed
Parameters
$nodeid : mixed
$permission : mixed = ''
$parents : mixed = false
Return values
mixed

2 element array

getChannelPermission()

Checks for a specific permission in a specific channel

public getChannelPermission(mixed $permissiongroup, mixed $permission, mixed $nodeid[, mixed $parents = false ][, mixed $parentid = false ]) : bool|int
Parameters
$permissiongroup : mixed
$permission : mixed
$nodeid : mixed
$parents : mixed = false
$parentid : mixed = false
Return values
bool|int

getLimit()

Checks for a limit-type permission- e.g. maximum number of images.

public getLimit(mixed $permission) : mixed
Parameters
$permission : mixed

getModeratorPerms()

This returns an array of moderator or moderator-like permissions

public getModeratorPerms(mixed $node) : mixed
Parameters
$node : mixed

getPermissionsFrom()

This function finds where permissions are set for a given node.

public getPermissionsFrom(mixed $groupid, mixed $nodeid[, mixed $parentid = false ]) : int
Parameters
$groupid : mixed
$nodeid : mixed
$parentid : mixed = false
Return values
int

the nodeid were permissions are checked.

getUsergroupLimit()

Checks for a limit-type permission in the usergroup table- e.g. maximum number of images.

public getUsergroupLimit(mixed $permission) : mixed
Parameters
$permission : mixed
Return values
mixed

false if this is not a valid request, -1 if there is no setting for this user's group or groups, or an integer

getUserLevel()

Gets user hierarchy level It is used when ignoring a user, the hierarchy is as follows (VBV-1503):

public getUserLevel() : mixed

SuperAdmin -> Admin -> Super moderator -> Moderator -> Regular user

hasAdminPermission()

Checks the administrator table for individual administrator permission (all the different areas of the admin cp that they can access)

public hasAdminPermission(mixed $permission) : bool
Parameters
$permission : mixed
Return values
bool

hasModeratorPermission()

public hasModeratorPermission(mixed $permission[, mixed $channelid = 0 ]) : mixed
Parameters
$permission : mixed
$channelid : mixed = 0

hasPermission()

Checks for a specific usergroup permission

public hasPermission(mixed $group, mixed $permission) : bool

For admin permissions use the hasAdminPermission method except for cancontrolpanel and ismoderator permission

Parameters
$group : mixed
$permission : mixed
Return values
bool

isAdministrator()

Returns whether the user is administrator Adapted from adminfunctions.php::can_administer

public isAdministrator() : bool
Return values
bool

isForumModerator()

public isForumModerator() : mixed

isGloballyIgnored()

Returns whether the user is globally ignored

public isGloballyIgnored() : bool
Return values
bool

isSuperAdmin()

check whether current user is super admin. Don't allow request for a different user.

public isSuperAdmin() : bool
Return values
bool

isSuperMod()

Returns whether the current user is a super moderator

public isSuperMod() : bool
Return values
bool

rebuildGroupAccess()

Convenience- since userContext is available everywhere, this calls permissionContext->public rebuildGroupAccess

public rebuildGroupAccess() : mixed

reloadGroupInTopic()

Reloads the groupInTopic data. Needed primarily in test.

public reloadGroupInTopic() : mixed

reloadUserPerms()

Initializes the user context with the permissions for the selected user.

public reloadUserPerms([bool $forceReload = false ]) : mixed

This is used for the initial constructor and can be used to refresh permissions if they have changed.

Parameters
$forceReload : bool = false

-- Do not use cached permissions


        
On this page

Search results