Permission model.

Models don't share that much, so most implementations will be adding methods onto this class. This class simply provides helper methods for common actions.

package XenForo_Permissions

 Methods

Constructor.

__construct() 
Inherited

Use create() statically unless you know what you're doing.

inherited_from \XenForo_Model::__construct()

Adds a join to the set of fetch options.

addFetchOptionJoin(array $fetchOptions, integer $join) 
Inherited

Join should be one of the constants.

inherited_from \XenForo_Model::addFetchOptionJoin()

Parameters

$fetchOptions

array

$join

integer

Adds the equivalent of a limit clause using position-based limits.

addPositionLimit(string $table, integer $limit, integer $offset, string $column) : string
Inherited

It no limit value is specified, nothing will be returned.

This must be added within a WHERE clause. If a clause is required, it will begin with "AND", so ensure there is a condition before it.

inherited_from \XenForo_Model::addPositionLimit()

Parameters

$table

string

Name of the table alias to prefix. May be blank for no table reference.

$limit

integer

Number of records to limit to; ignored if <= 0

$offset

integer

Offset from the start of the records. 0+

$column

string

Name of the column that is storing the position

Returns

stringPosition limit clause if needed

Appends the add-on navigation XML to a given DOM element.

appendPermissionsAddOnXml(\DOMElement $rootNode, string $addOnId) 

Parameters

$rootNode

\DOMElement

Node to append all navigation elements to

$addOnId

string

Add-on ID to be exported

Ensures that a valid cut-off operator is passed.

assertValidCutOffOperator(string $operator) 
Inherited

inherited_from \XenForo_Model::assertValidCutOffOperator()

Parameters

$operator

string

Builds the permission cache for a given combination (via user groups and user ID).

buildPermissionCacheForCombination(array $permissionsGrouped, array $systemEntries, array $groupEntries, array $userEntries, array $basePermissions, array $preDependencyCache) : array

Parameters

$permissionsGrouped

$systemEntries

array

List of system-wide permission entries

$groupEntries

$userEntries

array

List of user-specific permission entries (if any)

$basePermissions

array

Base set of permissions to use as a starting point

$preDependencyCache

array

Outputs the permissions before dependency checks - useful for hierarchies

Returns

arrayPermission cache details

Determines if the permissions development file is writable.

canWritePermissionsDevelopmentFile($fileName) : boolean

If the file does not exist, it checks whether the parent directory is writable.

Parameters

$fileName

Returns

boolean

Canonicalizes permission cache data into integers or true/false values from a version with deny/allow/unset/etc values.

canonicalizePermissionCache(array $cache) : array

This is the actual representation to be used externally.

Parameters

$cache

array

Permission cache info with allow/unset/deny/etc values

Returns

arrayPermission cache with true/false values

clearContentPermissionTypeHandlers()

clearContentPermissionTypeHandlers() 

Factory method to get the named model.

create(string $class) : \XenForo_Model
Inherited

The class must exist or be autoloadable or an exception will be thrown.

inherited_from \XenForo_Model::create()

Parameters

$class

string

Class to load

Returns

Deletes the sepcified permission combination.

deletePermissionCombination(integer $combinationId) 

Parameters

$combinationId

integer

Deletes the permissions that belong to the specified add-on.

deletePermissionsForAddOn(string $addOnId) 

Parameters

$addOnId

string

Fetches results from the database with each row keyed according to preference.

fetchAllKeyed(string $sql, string $key, mixed $bind, string $nullPrefix) : array
Inherited

The 'key' parameter provides the column name with which to key the result. For example, calling fetchAllKeyed('SELECT item_id, title, date FROM table', 'item_id') would result in an array keyed by item_id: [$itemId] => array('item_id' => $itemId, 'title' => $title, 'date' => $date)

Note that the specified key must exist in the query result, or it will be ignored.

inherited_from \XenForo_Model::fetchAllKeyed()

Parameters

$sql

string

SQL to execute

$key

string

Column with which to key the results array

$bind

mixed

Parameters for the SQL

$nullPrefix

string

If the key is null, prefix the counter with this

Returns

array

Finds or creates a permission combination using the specified combination parameters.

findOrCreatePermissionCombination(integer $userId, array $userGroupIds, boolean $buildOnCreate) : integer

The user ID should only be provided if permissions exist for that user.

Parameters

$userId

integer

User ID, if there are user-specific permissions

$userGroupIds

array

List of user group IDs

$buildOnCreate

boolean

Build permission combo cache if created

Returns

integerPermission combination ID

Finds an existing permission combination or creates a new one from a user info array.

findOrCreatePermissionCombinationFromUser(array $user, boolean $buildOnCreate, boolean $checkForUserPerms) : integer

Parameters

$user

array

User info

$buildOnCreate

boolean

Build the permission combo cache if it must be created

$checkForUserPerms

boolean

If false, assumes there are no user perms (optimization)

Returns

integerPermission combination ID

Gets all content permission entries for a type in an undefined order, grouped by the "level" of the permission.

getAllContentPermissionEntriesByTypeGrouped($permissionType) : array

This is generally only needed for internal cache rebuilds.

Note that entries with a value of "unset" will not be returned by this.

Parameters

$permissionType

Returns

arrayFormat: ['users'][user id][content id][group][permission] => permission value; ['userGroups'][user group id][content id][group][permission] => permission value; ['system'][content id][group][permission] => permission value

Gets all content-level permission entries for a user collection, grouped into their respective permission (not interface) groups.

getAllContentPermissionEntriesForUserCollectionGrouped(string $contentTypeId, integer $contentId, integer $userGroupId, integer $userId) : array

Parameters

$contentTypeId

string

$contentId

integer

$userGroupId

integer

$userId

integer

Returns

arrayFormat: [permission_group_id][permission_id] => permission_info

Gets all global-level permission entries for a user collection, grouped into their respective permission (not interface) groups.

getAllGlobalPermissionEntriesForUserCollectionGrouped(integer $userGroupId, integer $userId) : array

Parameters

$userGroupId

integer

$userId

integer

Returns

arrayFormat: [permission_group_id][permission_id] => permission_info

Gets information about all permission combinations.

getAllPermissionCombinations() : array

Note that this function does not return the cached permission data!

Returns

arrayFormat: [] => permission combo info (id, user, user group list)

Gets all permission entries in an undefined order, grouped by the "level" of the permission.

getAllPermissionEntriesGrouped() : array

This is generally only needed for internal cache rebuilds.

Note that entries with a value of "unset" will not be returned by this.

Returns

arrayFormat: ['users'][user id][group][permission] => permission value; ['userGroups'][user group id][group][permission] => permission value; ['system'][group][permission] => permission value

Gets all permission groups ordered by their ID.

getAllPermissionGroups() : array

Returns

arrayFormat: [] => permission group info

Gets all permission interface groups in order.

getAllPermissionInterfaceGroups() : array

Returns

arrayFormat: [interface group id] => interface group info

Get all permissions (ungrouped), in their relative display order.

getAllPermissions() : array

Proper display order cannot be gained unless the permissions are grouped into their interface groups.

Returns

arrayFormat: [] => permission info

Gets all permission grouped based on their internal permission groups.

getAllPermissionsGrouped() : array

This does not return based on interface groups.

Returns

arrayFormat: [permission group id][permission id] => permission info

Gets all permissions in their relative display order, with the correct/effective value for the specified user group or user.

getAllPermissionsWithValues(integer $userGroupId, integer $userId) : array

Parameters

$userGroupId

integer

$userId

integer

Returns

arrayFormat: [] => permission info, permission_value/permission_value_int from entry, value/value_int for effective value

Gets a list of SQL conditions in the format for a clause.

getConditionsForClause(array $sqlConditions) : string
Inherited

This always returns a value that can be used in a clause such as WHERE.

inherited_from \XenForo_Model::getConditionsForClause()

Parameters

$sqlConditions

array

Returns

string

Gets a content permission entry (for a user or group) by its entry ID

getContentPermissionEntryById(integer $id) : array | false

Parameters

$id

integer

Returns

arrayfalsePermission entry info

Gets objects that handle permission type build requests.

getContentPermissionTypeHandlers() : array

Returns

arrayFormat: [permission type id] => XenForo_ContentPermission_Interface object

Gets all content permission types in an undefined order.

getContentPermissionTypes() : array

Returns

arrayFormat: [content type] => permission handler class name

Gets content permissions from the specified groups in their relative display order, with the correct/effective value for the specified user group or user.

getContentPermissionsWithValues(string $contentTypeId, integer $contentId, mixed | array $permissionGroups, integer $userGroupId, integer $userId) : array

Parameters

$contentTypeId

string

$contentId

integer

$permissionGroups

mixedarray

If array, only pulls permissions from the specified groups; otherwise, all

$userGroupId

integer

$userId

integer

Returns

arrayFormat: [] => permission info, permission_value/permission_value_int from entry, value/value_int for effective value

Gets the specified field from a content type, if specified for that type.

getContentTypeField(string $contentType, string $fieldName) : string | false
Inherited

inherited_from \XenForo_Model::getContentTypeField()

Parameters

$contentType

string

$fieldName

string

Returns

stringfalse

Gets the value of the specified field for each content type that has that field.

getContentTypesWithField(string $fieldName) : array
Inherited

inherited_from \XenForo_Model::getContentTypesWithField()

Parameters

$fieldName

string

Returns

arrayFormat: [content type] => field value

Gets the default permission data.

getDefaultPermission() : array

Returns

array

Gets the default permission group data.

getDefaultPermissionGroup() : array

Returns

array

Gets the default permission interface group data.

getDefaultPermissionInterfaceGroup() : array

Returns

array

Gets all permissions, grouped into the interface groups, with values for the permissions coming from the default values.

getDefaultPermissionsForInterface() : array

Returns

arrayFormat: [interface group id] => interface group info + key:permissions => [] => permission info with effective value

Groups a list of permissions based on the interface group they belong to.

getInterfaceGroupedPermissions(array $permissions, array $interfaceGroups) : array

Parameters

$permissions

array

$interfaceGroups

array

Returns

arrayFormat: [interface group id] => interface group info + key:permissions => [] => permission info with effective value

Gets the specified model object from the cache.

getModelFromCache(string $class) : \XenForo_Model
Inherited

If it does not exist, it will be instantiated.

inherited_from \XenForo_Model::getModelFromCache()

Parameters

$class

string

Name of the class to load

Returns

Gets the order by clause for an SQL query.

getOrderByClause(array $choices, array $fetchOptions, string $defaultOrderSql) : string
Inherited

inherited_from \XenForo_Model::getOrderByClause()

Parameters

$choices

array

$fetchOptions

array

$defaultOrderSql

string

Returns

stringOrder by clause or empty string

Gets permissions grouped by their permission group and then their interface group.

getPermissionAndInterfaceGroupedPermissions(array $permissions, array $interfaceGroups) : array

This is needed when a system requires all permissions in one or more permission groups for display, but keeping the permissions together based on permission group.

Parameters

$permissions

array

$interfaceGroups

array

Returns

arrayFormat: [permission group id][interface group id] => interface group info, with key permissions => permissions in interface group

Gets the named permission based on it's group and ID.

getPermissionByGroupAndId(string $permissionGroupId, string $permissionId) : array | false

Both the group and the permission ID are required for unique identification.

Parameters

$permissionGroupId

string

$permissionId

string

Returns

arrayfalse

Gets the valid permission choices for the selected type of permission (based on context).

getPermissionChoices(string $type, boolean $contentSpecific) : array

Parameters

$type

string

Type of permission. Values: system, user, userGroup

$contentSpecific

boolean

True if dealing with content-specific permissions.

Returns

arrayKey-value pairs of choices for this type of permission

Gets the specified permission combination, including permission cache.

getPermissionCombinationById(integer $combinationId) : false | array

Parameters

$combinationId

integer

Returns

falsearrayPermission combination if, it it exists

Gets the permission combination that applies to a user.

getPermissionCombinationByUserId(integer $userId) : false | array

Returns false if no user ID is specified.

Parameters

$userId

integer

Returns

falsearrayPermission combo info

Gets a permission combination ID based on a specific user role (user ID if there are specific permissions and a list of user group ID).

getPermissionCombinationIdByUserRole(integer $userId, array $userGroupIds) : integer | false

Parameters

$userId

integer

$userGroupIds

array

Returns

integerfalseCombination ID or false

Gets all permission combinations that involve the specified user group.

getPermissionCombinationsByUserGroupId(integer $userGroupId) : array

Parameters

$userGroupId

integer

Returns

arrayFormat: [permission_combination_id] => permission combination info

Gets a permission entry (for a user or group) by its entry ID

getPermissionEntryById(integer $id) : array | false

Parameters

$id

integer

Returns

arrayfalsePermission entry info

Gets the specified permission group.

getPermissionGroupById(string $permissionGroupId) : array | false

Parameters

$permissionGroupId

string

Returns

arrayfalse

Gets a permission group's master title phrase text.

getPermissionGroupMasterTitlePhraseValue(string $permissionGroupId) : string

Parameters

$permissionGroupId

string

Returns

string

Gets all permission group names ordered by their ID.

getPermissionGroupNames() : array

Returns

arrayFormat: [group id] => name

Gets the phrase name for a permission group.

getPermissionGroupTitlePhraseName(string $permissionGroupId) : string

Parameters

$permissionGroupId

string

Returns

string

Gets all permission groups that belong to the specified add-on.

getPermissionGroupsByAddOn(string $addOnId) : array

Parameters

$addOnId

string

Returns

arrayFormat: [] => permission group info

Gets the named permission groups.

getPermissionGroupsByIds(array $groupIds) : array

Parameters

$groupIds

array

Returns

arrayFormat: [section id] => info

Gets the specified permission interface group.

getPermissionInterfaceGroupById(string $interfaceGroupId) : array | false

Parameters

$interfaceGroupId

string

Returns

arrayfalse

Gets a permission interface group's master title phrase text.

getPermissionInterfaceGroupMasterTitlePhraseValue(string $interfaceGroupId) : string

Parameters

$interfaceGroupId

string

Returns

string

Gets permission interface groups names in their display order.

getPermissionInterfaceGroupNames() : array

Returns

arrayFormat: [interface group id] => name

Gets the phrase name for a permission interface group.

getPermissionInterfaceGroupTitlePhraseName(string $interfaceGroupId) : string

Parameters

$interfaceGroupId

string

Returns

string

Gets all permission interface groups that belong to the specified add-on.

getPermissionInterfaceGroupsByAddOn(string $addOnId) : array

Parameters

$addOnId

string

Returns

arrayFormat: [] => permission interface group info

Gets the named permission interface groups.

getPermissionInterfaceGroupsByIds(array $groupIds) : array

Parameters

$groupIds

array

Returns

arrayFormat: [section id] => info

Gets a permission's master title phrase text.

getPermissionMasterTitlePhraseValue(string $permissionGroupId, string $permissionId) : string

Parameters

$permissionGroupId

string

$permissionId

string

Returns

string

Gets the phrase name for a permission.

getPermissionTitlePhraseName(string $permissionGroupId, string $permissionId) : string

Parameters

$permissionGroupId

string

$permissionId

string

Returns

string

Gets all permissions that belong to the specified add-on.

getPermissionsByAddOn(string $addOnId) : array

Parameters

$addOnId

string

Returns

arrayFormat: [] => permission info

Gets a collection of permissions by their group-permissions pairs.

getPermissionsByPairs(array $pairs) : array

Key 0 must be the group and key 1 must be the permission.

Parameters

$pairs

array

Format: [] => [0 => group id, 1 => permission id]

Returns

arrayArray of permissions grouped: [group id][permission id] => info

Gets the file name for the development output.

getPermissionsDevelopmentFileName() : string

Returns

string

Gets the permission development XML document.

getPermissionsDevelopmentXml() : \DOMDocument

Returns

Gets all content permissions, grouped into the permission groups and then interface groups, with values for the permissions specified for a particular group or user.

getUserCollectionContentPermissionsForGroupedInterface(string $contentTypeId, integer $contentId, mixed | string | array $permissionGroups, integer $userGroupId, integer $userId) : array

Parameters

$contentTypeId

string

$contentId

integer

$permissionGroups

mixedstringarray

If array, only those permission groups; if string, only that group; otherwise, all

$userGroupId

integer

$userId

integer

Returns

arrayFormat: [permission group id][interface group id] => interface group info, with key permissions => permissions in interface group

Gets all content permissions, grouped into the interface groups, with values for the permissions specified for a particular group or user.

getUserCollectionContentPermissionsForInterface(string $contentTypeId, integer $contentId, mixed | string | array $permissionGroups, integer $userGroupId, integer $userId) : array

Parameters

$contentTypeId

string

$contentId

integer

$permissionGroups

mixedstringarray

If array, only those permission groups; if string, only that group; otherwise, all

$userGroupId

integer

$userId

integer

Returns

arrayFormat: [interface group id] => interface group info + key:permissions => [] => permission info with effective value

Gets all permissions, grouped into the interface groups, with values for the permissions specified for a particular group or user.

getUserCollectionPermissionsForInterface(integer $userGroupId, integer $userId) : array

Parameters

$userGroupId

integer

$userId

integer

Returns

arrayFormat: [interface group id] => interface group info + key:permissions => [] => permission info with effective value

getUserCombinationsWithContentPermissions()

getUserCombinationsWithContentPermissions($contentType, $contentId) 

Parameters

$contentType

$contentId

getUsersWithContentUserPermissions()

getUsersWithContentUserPermissions($contentType, $contentId) 

Parameters

$contentType

$contentId

Gets all users that have global, custom user permissions.

getUsersWithGlobalUserPermissions() : array

Returns

array[user id] => info

Gets the view node permission attached to a specific node.

getViewNodeContentPermission(integer $nodeId, integer $userGroupId, integer $userId) : array

This permission is a bit weird since it doesn't fit in the expected groups, so it has to be handled specially.

Parameters

$nodeId

integer

$userGroupId

integer

$userId

integer

Returns

array

Imports the add-on permissions XML.

importPermissionsAddOnXml(\SimpleXMLElement $xml, string $addOnId) 

Parameters

$xml

\SimpleXMLElement

XML element pointing to the root of the navigation data

$addOnId

string

Add-on to import for

Imports the development permissions XML data.

importPermissionsDevelopmentXml(string $fileName) 

Parameters

$fileName

string

File to read the XML from

Applies a limit clause to the provided query if a limit value is specified.

limitQueryResults(string $query, integer $limit, integer $offset) : string
Inherited

If the limit value is 0 or less, no clause is applied.

inherited_from \XenForo_Model::limitQueryResults()

Parameters

$query

string

SQL query to run

$limit

integer

Number of records to limit to; ignored if <= 0

$offset

integer

Offset from the start of the records. 0+

Returns

stringQuery with limit applied if necessary

Returns true if a user has specific permissions set.

permissionsForUserExist(integer $userId) : boolean

Parameters

$userId

integer

Returns

boolean

Prepares the limit-related fetching options that can be applied to various queries.

prepareLimitFetchOptions(array $fetchOptions) : array
Inherited

Includes: limit, offset, page, and perPage.

inherited_from \XenForo_Model::prepareLimitFetchOptions()

Parameters

$fetchOptions

array

Unprepared options

Returns

arrayLimit options; keys: limit, offset

Prepares a permission for display.

preparePermission(array $permission) : array

Parameters

$permission

array

Returns

array

Prepares a permission group for display.

preparePermissionGroup(array $permissionGroup) : array

Parameters

$permissionGroup

array

Returns

array

Perpares a list of permission groups for display.

preparePermissionGroups(array $permissionGroups) : array

Parameters

$permissionGroups

array

Format: [] => permission group info

Returns

array

Prepares a permission interface group for display.

preparePermissionInterfaceGroup(array $interfaceGroup) : array

Parameters

$interfaceGroup

array

Returns

array

Perpares a list of permission interface groups for display.

preparePermissionInterfaceGroups(array $interfaceGroups) : array

Parameters

$interfaceGroups

array

Format: [] => interface group info

Returns

array

Prepares an ungrouped list of permissions for display.

preparePermissions(array $permissions) : array

Parameters

$permissions

array

Format: [] => permission info

Returns

array

Prepares a set of permissions that were grouped for display.

preparePermissionsGrouped(array $permissions) : array

Parameters

$permissions

array

Format: [group id][] => permission info

Returns

arrayPrepared array

Prepares state related fetch limits, based on the list of conditions.

prepareStateLimitFromConditions(array $fetchOptions, string $table, string $stateField, string $userField) : string
Inherited

Looks for keys "deleted" and "moderated".

inherited_from \XenForo_Model::prepareStateLimitFromConditions()

Parameters

$fetchOptions

array

$table

string

Name of the table to prefix the state and user fields with

$stateField

string

Name of the field that holds the state

$userField

string

Name of the field that holds the user ID

Returns

stringSQL condition to limit state

Rebuilds the content permission cache for the specified combination.

rebuildContentPermissionCombination(array $combination, array $permissionsGrouped, array $permCache) 

This function will rebuild permissions for all types of content and all pieces of content for that type.

Parameters

$combination

array

Array of combination information

$permissionsGrouped

array

List of permissions, grouped

$permCache

array

Global permission cache for this combination, with values of unset, etc. May be modified by ref.

Rebuilds all permission cache entries.

rebuildPermissionCache(integer $maxExecution, integer $startCombinationId) : boolean | integer

Parameters

$maxExecution

integer

Limit execution time

$startCombinationId

integer

If specified, starts the rebuild at the specified combination ID

Returns

booleanintegerTrue when totally complete; the next combination ID to start with otherwise

Rebuilds all permission cache data for combinations that involve the specified user group.

rebuildPermissionCacheForUserGroup(integer $userGroupId) : boolean

Parameters

$userGroupId

integer

Returns

booleanTrue on success

Rebuilds the permission cache for the specified user ID.

rebuildPermissionCacheForUserId(integer $userId) : boolean

A combination with this user ID must exist for a rebuild to be triggered.

Parameters

$userId

integer

Returns

booleanTrue on success (false if no cache needs to be updated)

Rebuilds the specified permission combination and updates the cache.

rebuildPermissionCombination(array $combination, array $permissionsGrouped, array $entries) : array

Parameters

$combination

array

Permission combination info

$permissionsGrouped

array

List of valid permissions, grouped

$entries

array

List of permission entries, with keys system/users/userGroups

Returns

arrayPermission cache for this combination.

Reset an entry or the entire local cache.

resetLocalCacheData($name) 
Inherited

This can be used if you know when some cached data has expired.

inherited_from \XenForo_Model::resetLocalCacheData()

Parameters

$name

Sets whether we're allowed to read values from the cache on a model-level.

setAllowCachedRead($allowCachedRead) 
Inherited

This may be controllable on an individual level basis, if the implementation allows it.

inherited_from \XenForo_Model::setAllowCachedRead()

Parameters

$allowCachedRead

boolean

Injects a local cache value.

setLocalCacheData(string $name, $value) 
Inherited

This should only be used if you know what you're doing or for testing purposes!

Note that you cannot get the existing data via the public interface. If you think you need the set data, use a new object. It defaults to empty. :)

inherited_from \XenForo_Model::setLocalCacheData()

Parameters

$name

string

$value

Standardizes a set of node permissions and a user ID to always have appropriate data.

standardizeNodePermissionsAndUserId(integer $nodeId, array | null $permissions, integer | null $userId) 
Inherited

If an invalid permission set or user ID is provided, the current visitor's will be used.

inherited_from \XenForo_Model::standardizeNodePermissionsAndUserId()

Parameters

$nodeId

integer

Node permissions are for

$permissions

arraynull

Permissions for node or null to use current visitor's permissions

$userId

integernull

User permissions belong to or null to use current visitor

Standardizes a permission combination and user ID to always have appropriate data.

standardizePermissionCombinationIdAndUserId(integer | null $permissionCombinationId, integer | null $userId) 
Inherited

If null, users current visitor's values.

inherited_from \XenForo_Model::standardizePermissionCombinationIdAndUserId()

Parameters

$permissionCombinationId

integernull

Permission combination ID or null to use current visitor

$userId

integernull

User permissions belong to or null to use current visitor

Standardizes a set of permissions and a user ID to always have appropriate data.

standardizePermissionsAndUserId(array | null $permissions, integer | null $userId) 
Inherited

If an invalid permission set or user ID is provided, the current visitor's will be used.

inherited_from \XenForo_Model::standardizePermissionsAndUserId()

Parameters

$permissions

arraynull

Global pPermissions or null to use current visitor's permissions

$userId

integernull

User permissions belong to or null to use current visitor

Standardizes a viewing user reference array.

standardizeViewingUserReference(array $viewingUser) 
Inherited

This array must contain all basic user info (preferably all user info) and include global permissions in a "permissions" key. If not an array or missing a user_id, the visitor's values will be used.

inherited_from \XenForo_Model::standardizeViewingUserReference()

Parameters

$viewingUser

arraynull

Standardizes the viewing user reference for the specific node.

standardizeViewingUserReferenceForNode(integer $nodeId, array $viewingUser, array $nodePermissions) 
Inherited

inherited_from \XenForo_Model::standardizeViewingUserReferenceForNode()

Parameters

$nodeId

integer

$viewingUser

arraynull

Viewing user; if null, use visitor

$nodePermissions

arraynull

Permissions for this node; if null, use visitor's

Helper to unserialize permissions in a list of items.

unserializePermissionsInList(array $items, string $serializedKey, string $targetKey) : array
Inherited

inherited_from \XenForo_Model::unserializePermissionsInList()

Parameters

$items

array

List of items

$serializedKey

string

Key where serialized permissions are

$targetKey

string

Key where unserialized permissions will go

Returns

arrayList of items with permissions unserialized

Updates the provded set of global permissions for a user collection (user group, user, system-wide).

updateContentPermissionsForUserCollection(array $newPermissions, string $contentTypeId, integer $contentId, integer $userGroupId, integer $userId) : boolean

Parameters

$newPermissions

array

Permissions to update, format: [permission_group_id][permission_id] => value

$contentTypeId

string

$contentId

integer

$userGroupId

integer

$userId

integer

Returns

boolean

Updates the provded set of global permissions for a user collection (user group, user, system-wide).

updateGlobalPermissionsForUserCollection(array $newPermissions, integer $userGroupId, integer $userId) : boolean

Parameters

$newPermissions

array

Permissions to update, format: [permission_group_id][permission_id] => value

$userGroupId

integer

$userId

integer

Returns

boolean

Updates a user's permission combination based on the current state in the database.

updateUserPermissionCombination(integer | array $userId, boolean $buildOnCreate, boolean $checkForUserPerms) : false | integer

Parameters

$userId

integerarray

Integer user ID or array of user info

$buildOnCreate

boolean

If true, the permission cache for a combination will be built if it's created

$checkForUserPerms

boolean

If false, doesn't look for user perms. Mostly an optimization

Returns

falseintegerCombination ID for the user if possible

Updates the permission combinations for a bunch of users.

updateUserPermissionCombinations(array $userIds, boolean $buildOnCreate) 

Parameters

$userIds

array

$buildOnCreate

boolean

Helper method to get the cache object.

_getCache(boolean $forceCachedRead) : \Zend_Cache_Core | \Zend_Cache_Frontend | false
Inherited

If cache reads are disabled, this will return false.

inherited_from \XenForo_Model::_getCache()

Parameters

$forceCachedRead

boolean

If true, the global "allow cached read" value is ignored

Returns

\Zend_Cache_Core\Zend_Cache_Frontendfalse

Gets the data registry model.

_getDataRegistryModel() : \XenForo_Model_DataRegistry
Inherited

inherited_from \XenForo_Model::_getDataRegistryModel()

Returns

Helper method to get the database object.

_getDb() : \Zend_Db_Adapter_Abstract
Inherited

inherited_from \XenForo_Model::_getDb()

Returns

\Zend_Db_Adapter_Abstract

Gets the named entry from the local cache.

_getLocalCacheData(string $name) : mixed
Inherited

inherited_from \XenForo_Model::_getLocalCacheData()

Parameters

$name

string

Returns

mixed

Gets the merged the permission priority value.

_getMergedPermissionPriorityValue(string | int $existingValue, string | int $newValue, string $permissionType) : string | int

Parameters

$existingValue

stringint

Existing value for the permission (int, or unset/allow/etc)

$newValue

stringint

New value for the permission (int, unset/allow/etc)

$permissionType

string

"integer" or "flag"

Returns

stringintEffective value for the permission, using the priority list

Gets the value of a permission using the priority list.

_getPermissionPriorityValueFromList(string $existingValue, array $permissionEntries, string $permissionType, string $permissionGroupId, string $permissionId, string $dependPermissionId) : string

For flag permissions, higher priority (lower numbers) will take priority over the already existing values. For integers, -1 (unlimited) is highest priority; otherwise, higher numbers are better.

Parameters

$existingValue

string

Existing permission value (strings like unset, allow, deny, etc)

$permissionEntries

array

List of permission entries to look through. First key is group, second is permission ID.

$permissionType

string

Type of permission (integer or flag)

$permissionGroupId

string

Permission Group ID to check

$permissionId

string

Permission ID to check

$dependPermissionId

string

The permission this one depends on; if this permission is not active, this permission is ignored

Returns

stringNew priority value

Gets the phrase model object.

_getPhraseModel() : \XenForo_Model_Phrase

Get user group model.

_getUserGroupModel() : \XenForo_Model_UserGroup

Get user model.

_getUserModel() : \XenForo_Model_User

Prepares an array of user groups into the list that is used in permission combination lookups (comma delimited, ascending order).

_prepareCombinationUserGroupList(array $userGroupIds) : string

Parameters

$userGroupIds

array

List of user group IDs

Returns

stringComma delimited, sorted string of user group IDs

Internal function to sanitize the user and user group values for use in a query against permission entries.

_sanitizeUserIdAndUserGroupForQuery(integer $userGroupId, integer $userId) 

Only one of the user group and user ID may be specified; if both are specified, the user ID takes precedence. If neither are specified, this relates to system-wide permissions.

Parameters

$userGroupId

integer

Modified by reference

$userId

integer

Modified by reference

Internal handler to update global or content permissions for the specified user collection.

_updatePermissionsForUserCollection(array $newPermissions, array $existingEntries, integer $userGroupId, integer $userId, string $dwName, array $bulkData) : boolean

Parameters

$newPermissions

array

Permissions to update, format: [permission_group_id][permission_id] => value

$existingEntries

array

Existing permission entries for this collection

$userGroupId

integer

$userId

integer

$dwName

string

Name of the data writer to use to insert/update data

$bulkData

array

Bulk data to give to the datawriter

Returns

boolean

 Properties

 

Controls whether a cached read is allowed.

$_allowCachedRead : boolean
Inherited

If not, it should be retrieved from the source.

inherited_from \XenForo_Model::$$_allowCachedRead
 

Cache object

$_cache : \Zend_Cache_Core | \Zend_Cache_Frontend
Inherited

inherited_from \XenForo_Model::$$_cache
 

Database object

$_db : \Zend_Db_Adapter_Abstract
Inherited

inherited_from \XenForo_Model::$$_db
 

Stores local, instance-specific cached data for each model.

$_localCacheData : array
Inherited

This data is generally treated as canonical, even if {$_allowCachedRead} is false.

inherited_from \XenForo_Model::$$_localCacheData
 

Standard approach to caching other model objects for the lifetime of the model.

$_modelCache : array
Inherited

inherited_from \XenForo_Model::$$_modelCache
 

List of priorites for permission values (unset, allow, deny, etc).

$_permissionPriority : array

Lower numbers are higher priority.