class vB_Api_UserGroup extends vB_Api

vB_Api_UserGroup

Traits

Constants

UNREGISTERED_SYSGROUPID

REGISTERED_SYSGROUPID

ADMINISTRATOR

SUPER_MODERATOR

MODERATOR

BANNED

CHANNEL_OWNER_SYSGROUPID

CHANNEL_MODERATOR_SYSGROUPID

CHANNEL_MEMBER_SYSGROUPID

SG_OWNER_SYSGROUPID

SG_MODERATOR_SYSGROUPID

SG_MEMBER_SYSGROUPID

CMS_AUTHOR_SYSGROUPID

CMS_EDITOR_SYSGROUPID

Properties

protected bool $disabled Indicates whether the API was disabled from vB_Api
protected array $disableWhiteList Contains white listed methods which act as normal when API is disabled no matter of special scenarios like forum closed, password expiry, ip ban and others. from vB_Api
protected array $disableFalseReturnOnly Contains white listed methods which return a false response when API is disabled in special scenarios like forum closed, password expiry, ip ban and others. from vB_Api
protected string $controller API Controller from vB_Api
protected vB_Database $db Database object. from vB_Api
protected $usergroupcache
protected $privateGroups

Methods

__sleep()

No description

__wakeup()

No description

static 
getApiClassName($controller)

No description

from vB_Api
static 
getApiClassNameInternal($controller)

No description

from vB_Api
static 
getApiClass($controller, $errorCheck = true)

No description

from vB_Api
static vB_Api
instanceInternal(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API

from vB_Api
static vB_Api
instance(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

from vB_Api
static 
clearCache()

Clears all previously loaded API objects.

from vB_Api
The
callNamed()

Call the given api function by name with a named arguments list.

from vB_Api
static string
map_vb4_input_to_vb5(string $method, array $request)

Returns vb5 api method name.

from vB_Api
static 
map_vb5_output_to_vb4(string $method, array $data)

Alters the output array in any way necessary to interface correctly with vb4.

from vB_Api
static 
map_vb5_errors_to_vb4(string $method, array $data)

Alters the error array in any way necessary to interface correctly with vb4.

from vB_Api
__construct()

No description

checkApiState($method)

This method checks whether the API method is enabled.

from vB_Api
bool
isWhiteListed(string $method)

Checks if method is white listed when API is disabled.

from vB_Api
bool
isDisableFalseReturnOnly(string $method)

Checks if method returns false response only when API is disabled.

from vB_Api
toSeoFriendly(string $str)

Replaces special characters in a given string with dashes to make the string SEO friendly

from vB_Api
none
checkHasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission, and if not throws an exception

from vB_Api
boolean
hasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission

from vB_Api
checkIsLoggedIn()

Determines if the calling user has the given admin permission, and if not throws an exception

from vB_Api
setController(string $controller)

Set controller

from vB_Api
inDebugMode()

No description

from vB_Api
array
fetchUsergroupList($flushcache = false)

Returns a list of all user groups.

fetchPrivateGroups()

Fetch the special groups. Used by permissions check. Each is a systemgroupid in the usergroups table

array
fetchUsergroupByID(int $usergroupid)

Fetch usergroup information by its ID

array
fetchUsergroupBySystemID(int $systemgroupid)

Fetch usergroup information by its SystemID

array
fetchDefaultData(int $usergroupid = 0)

Fetch default usergroup data for adding or editing new usergroup

int
save(array $usergroup, int $ugid_base = 0, int $usergroupid = 0)

Insert a new usergroup or update an existing usergroup

array
delete(int $usergroupid)

Delete an usergroup

array
removeLeader($usergroupleaderid)

Remove usergroup leader from an usergroup

int
addLeader(int $usergroupid, int $userid)

Add a leader for an usergroup

array
fetchPromotions(int $usergroupid = 0)

Fetch a list of usergroup promotions

int
savePromotion(array $promotion, int $usergroupid, int $userpromotionid = 0)

Insert a new usergroup promotion or update an existing one

void
deletePromotion($userpromotionid)

Delete an usergroup promotion

array
fetchJoinRequests(int $usergroupid = 0)

Fetch a list of usergroup join requests

array
updateDisplayGroup($userid, $usergroupid)

Update user's display group

fetchBannedUsergroups()

Fetch a list of banned usergroups

false|int
getModeratorGroupId()

Returns the usergroupid for moderator group

false|int
getOwnerGroupId()

Returns the usergroupid for owner group

false|int
getMemberGroupId()

Returns the usergroupid for member group

array
getMultipleGroupIds(array $groups)

Returns the usergroupids for multiple specified SYSGROUPID constants

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

in vB_Api at line 63
static getApiClassName($controller)

Parameters

$controller

in vB_Api at line 69
static protected getApiClassNameInternal($controller)

Parameters

$controller

in vB_Api at line 97
static protected getApiClass($controller, $errorCheck = true)

Parameters

$controller
$errorCheck

in vB_Api at line 177
static vB_Api instanceInternal(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API

Parameters

string $controller -- name of the API controller to load
bool $refresh_cache -- true if we want to force the cache to update with a new api object primarily intended for testing

Return Value

vB_Api

in vB_Api at line 203
static vB_Api instance(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

Parameters

string $controller -- name of the API controller to load
bool $refresh_cache -- true if we want to force the cache to update with a new api object primarily intended for testing

Return Value

vB_Api

in vB_Api at line 237
static clearCache()

Clears all previously loaded API objects.

Intended for use in tests where the loading pattern can cause issues with objects that cache thier own data.

in vB_Api at line 259
The callNamed()

Call the given api function by name with a named arguments list.

Used primarily to translate REST requests into API calls.

Return Value

The return of the method or an error if the method doesn't exist, or is static, a constructor or destructor, or otherwise shouldn't be callable as and API method. It is also an error if the value of a paramater is not provided and that parameter doesn't have a default value.

in vB_Api at line 313
static string map_vb4_input_to_vb5(string $method, array $request)

Returns vb5 api method name.

May alter request array.

Parameters

string $method -- vb4 method name
array $request -- $_REQUEST array for this api request

Return Value

string

in vB_Api at line 497
static map_vb5_output_to_vb4(string $method, array $data)

Alters the output array in any way necessary to interface correctly with vb4.

Parameters

string $method -- vb4 method name
array $data -- output array from vb5

in vB_Api at line 545
static map_vb5_errors_to_vb4(string $method, array $data)

Alters the error array in any way necessary to interface correctly with vb4.

Parameters

string $method -- vb4 method name
array $data -- error array from vb5

at line 45
protected __construct()

in vB_Api at line 631
checkApiState($method)

This method checks whether the API method is enabled.

For extensions check make sure $controller property is already set.

Parameters

$method

in vB_Api at line 657
protected bool isWhiteListed(string $method)

Checks if method is white listed when API is disabled.

Parameters

string $method API method to check.

Return Value

bool Indicates whether method is or is not a white list.

in vB_Api at line 685
protected bool isDisableFalseReturnOnly(string $method)

Checks if method returns false response only when API is disabled.

Parameters

string $method API method to check.

Return Value

bool Indicates whether method returns false response only.

in vB_Api at line 712
protected toSeoFriendly(string $str)

Replaces special characters in a given string with dashes to make the string SEO friendly

Parameters

string $str The string to be converted

in vB_Api at line 734
protected none checkHasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission, and if not throws an exception

Checks for: * A valid CP Session * The passed adminpermission.

Parameters

string $adminPermission The admin permission to check

Return Value

none

Exceptions

inlinemodauth_required -- The current session is not a mod/admin session
nopermission_loggedin -- The user does not have the given permission
no_permission -- The user is not logged in at all.

in vB_Api at line 753
protected boolean hasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission

Useful if you need to know if the calling user but do not care why they do not have that permission. Generally useful if there is a behavior difference between admins and non admins, but the call can be processed for either.

Parameters

string $adminPermission The admin permission to check

Return Value

boolean true if checks pass, false otherwise

in vB_Api at line 807
protected checkIsLoggedIn()

Determines if the calling user has the given admin permission, and if not throws an exception

in vB_Api at line 821
protected setController(string $controller)

Set controller

Parameters

string $controller Controller name

in vB_Api at line 831
protected inDebugMode()

at line 115
array fetchUsergroupList($flushcache = false)

Returns a list of all user groups.

Returns extra fields if the user has canadminpermissions

Parameters

$flushcache

Return Value

array -- array of groups each with the fields: * canoverride * closetag * description * ispublicgroup * opentag * systemgroupid * title * usergroupid * usertitle

(Admin only)

* adminpermissions * albummaxpics * albummaxsize * albumpermissions * albumpicmaxheight * albumpicmaxwidth * attachlimit * avatarmaxheight * avatarmaxsize * avatarmaxwidth * calendarpermissions * createpermissions * forumpermissions * forumpermissions2 * genericoptions * genericpermissions * genericpermissions2 * groupiconmaxsize * maximumsocialgroups * passwordhistory * passwordexpires * pmpermissions * pmquota * pmsendmax * pmthrottlequantity * profilepicmaxheight * profilepicmaxsize * profilepicmaxwidth * sigmaxchars * sigmaximages * sigmaxlines * sigmaxrawchars * sigmaxsizebbcode * signaturepermissions * sigpicmaxheight * sigpicmaxsize * sigpicmaxwidth * socialgrouppermissions * usercsspermissions * visitormessagepermissions * wolpermissions

at line 147
fetchPrivateGroups()

Fetch the special groups. Used by permissions check. Each is a systemgroupid in the usergroups table

@return array -- usergroup ids

at line 161
array fetchUsergroupByID(int $usergroupid)

Fetch usergroup information by its ID

Returns extra fields if the user has canadminpermissions

Parameters

int $usergroupid Usergroup ID

Return Value

array Usergroup information -- returns usergroup array

See also

fetchUsergroupList for fields

at line 266
array fetchUsergroupBySystemID(int $systemgroupid)

Fetch usergroup information by its SystemID

Parameters

int $systemgroupid

Return Value

array Usergroup information -- returns usergroup array

See also

fetchUsergroupList for fields

at line 290
array fetchDefaultData(int $usergroupid = 0)

Fetch default usergroup data for adding or editing new usergroup

Parameters

int $usergroupid If present, the data will be copied from this usergroup

Return Value

array Default usergroup data. It contains four sub-arrays: 'usergroup' - Basic usergroup information 'ugarr' - usergroups to be used for 'Create Forum Permissions Based off of Usergroup' 'ug_bitfield' - Usergroup bitfield 'groupinfo' - Usergroup permission information

at line 408
int save(array $usergroup, int $ugid_base = 0, int $usergroupid = 0)

Insert a new usergroup or update an existing usergroup

Parameters

array $usergroup Usergroup information to be inserted or updated
int $ugid_base Usergroup ID. New inserted usergroup's forum permission will based on this usergroup.
int $usergroupid when updating an existing usergroup, pass usergroup ID as this parameter

Return Value

int New or existing usergroup ID

at line 672
array delete(int $usergroupid)

Delete an usergroup

Parameters

int $usergroupid Usergroup ID to be deleted

Return Value

array -- standard success array

at line 841
array removeLeader($usergroupleaderid)

Remove usergroup leader from an usergroup

Parameters

$usergroupleaderid Leader's user ID to be removed

Return Value

array -- standard success array

at line 861
int addLeader(int $usergroupid, int $userid)

Add a leader for an usergroup

Parameters

int $usergroupid
int $userid

Return Value

int New usergroupleader ID

at line 951
array fetchPromotions(int $usergroupid = 0)

Fetch a list of usergroup promotions

Parameters

int $usergroupid Fetch promotions for only this usergroup

Return Value

array Promotions information

at line 985
int savePromotion(array $promotion, int $usergroupid, int $userpromotionid = 0)

Insert a new usergroup promotion or update an existing one

Parameters

array $promotion Promotion information with fields: * usergroupid * reputation * date * posts * strategy * type * reputationtype * joinusergroupid
int $usergroupid
int $userpromotionid Existing Usergroup promotion ID to be updated

Return Value

int new or existing userpromotion ID

at line 1048
void deletePromotion($userpromotionid)

Delete an usergroup promotion

Parameters

$userpromotionid

Return Value

void

at line 1070
array fetchJoinRequests(int $usergroupid = 0)

Fetch a list of usergroup join requests

Parameters

int $usergroupid Usergroup ID. If 0, this method will return a list of usergroups which have join requests.

Return Value

array If $usergroupid is 0, it will return a list of usergroups which have join requests. If $usergroupid is not 0, it will return an array of join requests. If the return is an empty array, it means no join requests for all usergroups (usergroupid = 0) or for the specified usergroup ($usergroupid != 0)

at line 1588
array updateDisplayGroup($userid, $usergroupid)

Update user's display group

Parameters

$userid User ID
$usergroupid Usergroup ID to be used as display group

Return Value

array -- standard success array

at line 1653
fetchBannedUsergroups()

Fetch a list of banned usergroups

at line 1690
false|int getModeratorGroupId()

Returns the usergroupid for moderator group

Return Value

false|int

at line 1708
false|int getOwnerGroupId()

Returns the usergroupid for owner group

Return Value

false|int

at line 1726
false|int getMemberGroupId()

Returns the usergroupid for member group

Return Value

false|int

at line 1747
array getMultipleGroupIds(array $groups)

Returns the usergroupids for multiple specified SYSGROUPID constants

Parameters

array $groups -- int, the systemIDs to look up the db ids from

Return Value

array -- usergroup ids -- NOTE: The usergroups in the return array are in the same order as in the input array. Some callers depend on this behavior.