__construct()
addFetchOptionJoin()
addPositionLimit()
appendPermissionsAddOnXml()
assertValidCutOffOperator()
buildPermissionCacheForCombination()
canWritePermissionsDevelopmentFile()
canonicalizePermissionCache()
clearContentPermissionTypeHandlers()
create()
deletePermissionCombination()
deletePermissionsForAddOn()
fetchAllKeyed()
findOrCreatePermissionCombination()
findOrCreatePermissionCombinationFromUser()
getAllContentPermissionEntriesByTypeGrouped()
getAllContentPermissionEntriesForUserCollectionGrouped()
getAllGlobalPermissionEntriesForUserCollectionGrouped()
getAllPermissionCombinations()
getAllPermissionEntriesGrouped()
getAllPermissionGroups()
getAllPermissionInterfaceGroups()
getAllPermissions()
getAllPermissionsGrouped()
getAllPermissionsWithValues()
getConditionsForClause()
getContentPermissionEntryById()
getContentPermissionTypeHandlers()
getContentPermissionTypes()
getContentPermissionsWithValues()
getContentTypeField()
getContentTypesWithField()
getDefaultPermission()
getDefaultPermissionGroup()
getDefaultPermissionInterfaceGroup()
getDefaultPermissionsForInterface()
getInterfaceGroupedPermissions()
getModelFromCache()
getOrderByClause()
getPermissionAndInterfaceGroupedPermissions()
getPermissionByGroupAndId()
getPermissionChoices()
getPermissionCombinationById()
getPermissionCombinationByUserId()
getPermissionCombinationIdByUserRole()
getPermissionCombinationsByUserGroupId()
getPermissionEntryById()
getPermissionGroupById()
getPermissionGroupMasterTitlePhraseValue()
getPermissionGroupNames()
getPermissionGroupTitlePhraseName()
getPermissionGroupsByAddOn()
getPermissionGroupsByIds()
getPermissionInterfaceGroupById()
getPermissionInterfaceGroupMasterTitlePhraseValue()
getPermissionInterfaceGroupNames()
getPermissionInterfaceGroupTitlePhraseName()
getPermissionInterfaceGroupsByAddOn()
getPermissionInterfaceGroupsByIds()
getPermissionMasterTitlePhraseValue()
getPermissionTitlePhraseName()
getPermissionsByAddOn()
getPermissionsByPairs()
getPermissionsDevelopmentFileName()
getPermissionsDevelopmentXml()
getUserCollectionContentPermissionsForGroupedInterface()
getUserCollectionContentPermissionsForInterface()
getUserCollectionPermissionsForInterface()
getUserCombinationsWithContentPermissions()
getUsersWithContentUserPermissions()
getUsersWithGlobalUserPermissions()
getViewNodeContentPermission()
importPermissionsAddOnXml()
importPermissionsDevelopmentXml()
limitQueryResults()
permissionsForUserExist()
prepareLimitFetchOptions()
preparePermission()
preparePermissionGroup()
preparePermissionGroups()
preparePermissionInterfaceGroup()
preparePermissionInterfaceGroups()
preparePermissions()
preparePermissionsGrouped()
prepareStateLimitFromConditions()
rebuildContentPermissionCombination()
rebuildPermissionCache()
rebuildPermissionCacheForUserGroup()
rebuildPermissionCacheForUserId()
rebuildPermissionCombination()
resetLocalCacheData()
setAllowCachedRead()
setLocalCacheData()
standardizeNodePermissionsAndUserId()
standardizePermissionCombinationIdAndUserId()
standardizePermissionsAndUserId()
standardizeViewingUserReference()
standardizeViewingUserReferenceForNode()
unserializePermissionsInList()
updateContentPermissionsForUserCollection()
updateGlobalPermissionsForUserCollection()
updateUserPermissionCombination()
updateUserPermissionCombinations()
_getCache()
_getDataRegistryModel()
_getDb()
_getLocalCacheData()
_getMergedPermissionPriorityValue()
_getPermissionPriorityValueFromList()
_getPhraseModel()
_getUserGroupModel()
_getUserModel()
_prepareCombinationUserGroupList()
_sanitizeUserIdAndUserGroupForQuery()
_updatePermissionsForUserCollection()
$_allowCachedRead
$_cache
$_db
$_localCacheData
$_modelCache
$_permissionPriority
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 |
---|
__construct()
Use create() statically unless you know what you're doing.
inherited_from | \XenForo_Model::__construct() |
---|
addFetchOptionJoin(array $fetchOptions, integer $join)
Join should be one of the constants.
inherited_from | \XenForo_Model::addFetchOptionJoin() |
---|
array
integer
addPositionLimit(string $table, integer $limit, integer $offset, string $column) : string
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() |
---|
string
Name of the table alias to prefix. May be blank for no table reference.
integer
Number of records to limit to; ignored if <= 0
integer
Offset from the start of the records. 0+
string
Name of the column that is storing the position
string
Position limit clause if neededappendPermissionsAddOnXml(\DOMElement $rootNode, string $addOnId)
string
Add-on ID to be exported
assertValidCutOffOperator(string $operator)
inherited_from | \XenForo_Model::assertValidCutOffOperator() |
---|
string
buildPermissionCacheForCombination(array $permissionsGrouped, array $systemEntries, array $groupEntries, array $userEntries, array $basePermissions, array $preDependencyCache) : array
array
List of system-wide permission entries
array
List of user-specific permission entries (if any)
array
Base set of permissions to use as a starting point
array
Outputs the permissions before dependency checks - useful for hierarchies
array
Permission cache detailscanWritePermissionsDevelopmentFile($fileName) : boolean
If the file does not exist, it checks whether the parent directory is writable.
boolean
canonicalizePermissionCache(array $cache) : array
This is the actual representation to be used externally.
array
Permission cache info with allow/unset/deny/etc values
array
Permission cache with true/false valuesclearContentPermissionTypeHandlers()
create(string $class) : \XenForo_Model
The class must exist or be autoloadable or an exception will be thrown.
inherited_from | \XenForo_Model::create() |
---|
string
Class to load
deletePermissionCombination(integer $combinationId)
integer
deletePermissionsForAddOn(string $addOnId)
string
fetchAllKeyed(string $sql, string $key, mixed $bind, string $nullPrefix) : array
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() |
---|
string
SQL to execute
string
Column with which to key the results array
mixed
Parameters for the SQL
string
If the key is null, prefix the counter with this
array
findOrCreatePermissionCombination(integer $userId, array $userGroupIds, boolean $buildOnCreate) : integer
The user ID should only be provided if permissions exist for that user.
integer
User ID, if there are user-specific permissions
array
List of user group IDs
boolean
Build permission combo cache if created
integer
Permission combination IDfindOrCreatePermissionCombinationFromUser(array $user, boolean $buildOnCreate, boolean $checkForUserPerms) : integer
array
User info
boolean
Build the permission combo cache if it must be created
boolean
If false, assumes there are no user perms (optimization)
integer
Permission combination IDgetAllContentPermissionEntriesByTypeGrouped($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.
array
Format: ['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 valuegetAllContentPermissionEntriesForUserCollectionGrouped(string $contentTypeId, integer $contentId, integer $userGroupId, integer $userId) : array
string
integer
integer
integer
array
Format: [permission_group_id][permission_id] => permission_infogetAllGlobalPermissionEntriesForUserCollectionGrouped(integer $userGroupId, integer $userId) : array
integer
integer
array
Format: [permission_group_id][permission_id] => permission_infogetAllPermissionCombinations() : array
Note that this function does not return the cached permission data!
array
Format: [] => permission combo info (id, user, user group list)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.
array
Format: ['users'][user id][group][permission] => permission value; ['userGroups'][user group id][group][permission] => permission value; ['system'][group][permission] => permission valuegetAllPermissionGroups() : array
array
Format: [] => permission group infogetAllPermissionInterfaceGroups() : array
array
Format: [interface group id] => interface group infogetAllPermissions() : array
Proper display order cannot be gained unless the permissions are grouped into their interface groups.
array
Format: [] => permission infogetAllPermissionsGrouped() : array
This does not return based on interface groups.
array
Format: [permission group id][permission id] => permission infogetAllPermissionsWithValues(integer $userGroupId, integer $userId) : array
integer
integer
array
Format: [] => permission info, permission_value/permission_value_int from entry, value/value_int for effective valuegetConditionsForClause(array $sqlConditions) : string
This always returns a value that can be used in a clause such as WHERE.
inherited_from | \XenForo_Model::getConditionsForClause() |
---|
array
string
getContentPermissionEntryById(integer $id) : array | false
integer
array
false
Permission entry infogetContentPermissionTypeHandlers() : array
array
Format: [permission type id] => XenForo_ContentPermission_Interface objectgetContentPermissionTypes() : array
array
Format: [content type] => permission handler class namegetContentPermissionsWithValues(string $contentTypeId, integer $contentId, mixed | array $permissionGroups, integer $userGroupId, integer $userId) : array
string
integer
mixed
array
If array, only pulls permissions from the specified groups; otherwise, all
integer
integer
array
Format: [] => permission info, permission_value/permission_value_int from entry, value/value_int for effective valuegetContentTypeField(string $contentType, string $fieldName) : string | false
inherited_from | \XenForo_Model::getContentTypeField() |
---|
string
string
string
false
getContentTypesWithField(string $fieldName) : array
inherited_from | \XenForo_Model::getContentTypesWithField() |
---|
string
array
Format: [content type] => field valuegetDefaultPermission() : array
array
getDefaultPermissionGroup() : array
array
getDefaultPermissionInterfaceGroup() : array
array
getDefaultPermissionsForInterface() : array
array
Format: [interface group id] => interface group info + key:permissions => [] => permission info with effective valuegetInterfaceGroupedPermissions(array $permissions, array $interfaceGroups) : array
array
array
array
Format: [interface group id] => interface group info + key:permissions => [] => permission info with effective valuegetModelFromCache(string $class) : \XenForo_Model
If it does not exist, it will be instantiated.
inherited_from | \XenForo_Model::getModelFromCache() |
---|
string
Name of the class to load
getOrderByClause(array $choices, array $fetchOptions, string $defaultOrderSql) : string
inherited_from | \XenForo_Model::getOrderByClause() |
---|
array
array
string
string
Order by clause or empty stringgetPermissionAndInterfaceGroupedPermissions(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.
array
array
array
Format: [permission group id][interface group id] => interface group info, with key permissions => permissions in interface groupgetPermissionByGroupAndId(string $permissionGroupId, string $permissionId) : array | false
Both the group and the permission ID are required for unique identification.
string
string
array
false
getPermissionChoices(string $type, boolean $contentSpecific) : array
string
Type of permission. Values: system, user, userGroup
boolean
True if dealing with content-specific permissions.
array
Key-value pairs of choices for this type of permissiongetPermissionCombinationById(integer $combinationId) : false | array
integer
false
array
Permission combination if, it it existsgetPermissionCombinationByUserId(integer $userId) : false | array
Returns false if no user ID is specified.
integer
false
array
Permission combo infogetPermissionCombinationIdByUserRole(integer $userId, array $userGroupIds) : integer | false
integer
array
integer
false
Combination ID or falsegetPermissionCombinationsByUserGroupId(integer $userGroupId) : array
integer
array
Format: [permission_combination_id] => permission combination infogetPermissionEntryById(integer $id) : array | false
integer
array
false
Permission entry infogetPermissionGroupById(string $permissionGroupId) : array | false
string
array
false
getPermissionGroupMasterTitlePhraseValue(string $permissionGroupId) : string
string
string
getPermissionGroupNames() : array
array
Format: [group id] => namegetPermissionGroupTitlePhraseName(string $permissionGroupId) : string
string
string
getPermissionGroupsByAddOn(string $addOnId) : array
string
array
Format: [] => permission group infogetPermissionGroupsByIds(array $groupIds) : array
array
array
Format: [section id] => infogetPermissionInterfaceGroupById(string $interfaceGroupId) : array | false
string
array
false
getPermissionInterfaceGroupMasterTitlePhraseValue(string $interfaceGroupId) : string
string
string
getPermissionInterfaceGroupNames() : array
array
Format: [interface group id] => namegetPermissionInterfaceGroupTitlePhraseName(string $interfaceGroupId) : string
string
string
getPermissionInterfaceGroupsByAddOn(string $addOnId) : array
string
array
Format: [] => permission interface group infogetPermissionInterfaceGroupsByIds(array $groupIds) : array
array
array
Format: [section id] => infogetPermissionMasterTitlePhraseValue(string $permissionGroupId, string $permissionId) : string
string
string
string
getPermissionTitlePhraseName(string $permissionGroupId, string $permissionId) : string
string
string
string
getPermissionsByAddOn(string $addOnId) : array
string
array
Format: [] => permission infogetPermissionsByPairs(array $pairs) : array
Key 0 must be the group and key 1 must be the permission.
array
Format: [] => [0 => group id, 1 => permission id]
array
Array of permissions grouped: [group id][permission id] => infogetPermissionsDevelopmentFileName() : string
string
getUserCollectionContentPermissionsForGroupedInterface(string $contentTypeId, integer $contentId, mixed | string | array $permissionGroups, integer $userGroupId, integer $userId) : array
string
integer
mixed
string
array
If array, only those permission groups; if string, only that group; otherwise, all
integer
integer
array
Format: [permission group id][interface group id] => interface group info, with key permissions => permissions in interface groupgetUserCollectionContentPermissionsForInterface(string $contentTypeId, integer $contentId, mixed | string | array $permissionGroups, integer $userGroupId, integer $userId) : array
string
integer
mixed
string
array
If array, only those permission groups; if string, only that group; otherwise, all
integer
integer
array
Format: [interface group id] => interface group info + key:permissions => [] => permission info with effective valuegetUserCollectionPermissionsForInterface(integer $userGroupId, integer $userId) : array
integer
integer
array
Format: [interface group id] => interface group info + key:permissions => [] => permission info with effective valuegetUserCombinationsWithContentPermissions($contentType, $contentId)
getUsersWithContentUserPermissions($contentType, $contentId)
getUsersWithGlobalUserPermissions() : array
array
[user id] => infogetViewNodeContentPermission(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.
integer
integer
integer
array
importPermissionsAddOnXml(\SimpleXMLElement $xml, string $addOnId)
string
Add-on to import for
importPermissionsDevelopmentXml(string $fileName)
string
File to read the XML from
limitQueryResults(string $query, integer $limit, integer $offset) : string
If the limit value is 0 or less, no clause is applied.
inherited_from | \XenForo_Model::limitQueryResults() |
---|
string
SQL query to run
integer
Number of records to limit to; ignored if <= 0
integer
Offset from the start of the records. 0+
string
Query with limit applied if necessaryprepareLimitFetchOptions(array $fetchOptions) : array
Includes: limit, offset, page, and perPage.
inherited_from | \XenForo_Model::prepareLimitFetchOptions() |
---|
array
Unprepared options
array
Limit options; keys: limit, offsetpreparePermission(array $permission) : array
array
array
preparePermissionGroup(array $permissionGroup) : array
array
array
preparePermissionGroups(array $permissionGroups) : array
array
Format: [] => permission group info
array
preparePermissionInterfaceGroup(array $interfaceGroup) : array
array
array
preparePermissionInterfaceGroups(array $interfaceGroups) : array
array
Format: [] => interface group info
array
preparePermissions(array $permissions) : array
array
Format: [] => permission info
array
preparePermissionsGrouped(array $permissions) : array
array
Format: [group id][] => permission info
array
Prepared arrayprepareStateLimitFromConditions(array $fetchOptions, string $table, string $stateField, string $userField) : string
Looks for keys "deleted" and "moderated".
inherited_from | \XenForo_Model::prepareStateLimitFromConditions() |
---|
array
string
Name of the table to prefix the state and user fields with
string
Name of the field that holds the state
string
Name of the field that holds the user ID
string
SQL condition to limit staterebuildContentPermissionCombination(array $combination, array $permissionsGrouped, array $permCache)
This function will rebuild permissions for all types of content and all pieces of content for that type.
array
Array of combination information
array
List of permissions, grouped
array
Global permission cache for this combination, with values of unset, etc. May be modified by ref.
rebuildPermissionCache(integer $maxExecution, integer $startCombinationId) : boolean | integer
integer
Limit execution time
integer
If specified, starts the rebuild at the specified combination ID
boolean
integer
True when totally complete; the next combination ID to start with otherwiserebuildPermissionCacheForUserGroup(integer $userGroupId) : boolean
integer
boolean
True on successrebuildPermissionCacheForUserId(integer $userId) : boolean
A combination with this user ID must exist for a rebuild to be triggered.
integer
boolean
True on success (false if no cache needs to be updated)rebuildPermissionCombination(array $combination, array $permissionsGrouped, array $entries) : array
array
Permission combination info
array
List of valid permissions, grouped
array
List of permission entries, with keys system/users/userGroups
array
Permission cache for this combination.resetLocalCacheData($name)
This can be used if you know when some cached data has expired.
inherited_from | \XenForo_Model::resetLocalCacheData() |
---|
setAllowCachedRead($allowCachedRead)
This may be controllable on an individual level basis, if the implementation allows it.
inherited_from | \XenForo_Model::setAllowCachedRead() |
---|
boolean
setLocalCacheData(string $name, $value)
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() |
---|
string
standardizeNodePermissionsAndUserId(integer $nodeId, array | null $permissions, integer | null $userId)
If an invalid permission set or user ID is provided, the current visitor's will be used.
inherited_from | \XenForo_Model::standardizeNodePermissionsAndUserId() |
---|
integer
Node permissions are for
array
null
Permissions for node or null to use current visitor's permissions
integer
null
User permissions belong to or null to use current visitor
standardizePermissionCombinationIdAndUserId(integer | null $permissionCombinationId, integer | null $userId)
If null, users current visitor's values.
inherited_from | \XenForo_Model::standardizePermissionCombinationIdAndUserId() |
---|
integer
null
Permission combination ID or null to use current visitor
integer
null
User permissions belong to or null to use current visitor
standardizePermissionsAndUserId(array | null $permissions, integer | null $userId)
If an invalid permission set or user ID is provided, the current visitor's will be used.
inherited_from | \XenForo_Model::standardizePermissionsAndUserId() |
---|
array
null
Global pPermissions or null to use current visitor's permissions
integer
null
User permissions belong to or null to use current visitor
standardizeViewingUserReference(array $viewingUser)
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() |
---|
array
null
standardizeViewingUserReferenceForNode(integer $nodeId, array $viewingUser, array $nodePermissions)
inherited_from | \XenForo_Model::standardizeViewingUserReferenceForNode() |
---|
integer
array
null
Viewing user; if null, use visitor
array
null
Permissions for this node; if null, use visitor's
unserializePermissionsInList(array $items, string $serializedKey, string $targetKey) : array
inherited_from | \XenForo_Model::unserializePermissionsInList() |
---|
array
List of items
string
Key where serialized permissions are
string
Key where unserialized permissions will go
array
List of items with permissions unserializedupdateContentPermissionsForUserCollection(array $newPermissions, string $contentTypeId, integer $contentId, integer $userGroupId, integer $userId) : boolean
array
Permissions to update, format: [permission_group_id][permission_id] => value
string
integer
integer
integer
boolean
updateGlobalPermissionsForUserCollection(array $newPermissions, integer $userGroupId, integer $userId) : boolean
array
Permissions to update, format: [permission_group_id][permission_id] => value
integer
integer
boolean
updateUserPermissionCombination(integer | array $userId, boolean $buildOnCreate, boolean $checkForUserPerms) : false | integer
integer
array
Integer user ID or array of user info
boolean
If true, the permission cache for a combination will be built if it's created
boolean
If false, doesn't look for user perms. Mostly an optimization
false
integer
Combination ID for the user if possibleupdateUserPermissionCombinations(array $userIds, boolean $buildOnCreate)
array
boolean
_getCache(boolean $forceCachedRead) : \Zend_Cache_Core | \Zend_Cache_Frontend | false
If cache reads are disabled, this will return false.
inherited_from | \XenForo_Model::_getCache() |
---|
boolean
If true, the global "allow cached read" value is ignored
\Zend_Cache_Core
\Zend_Cache_Frontend
false
_getDb() : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_Model::_getDb() |
---|
\Zend_Db_Adapter_Abstract
_getLocalCacheData(string $name) : mixed
inherited_from | \XenForo_Model::_getLocalCacheData() |
---|
string
mixed
_getMergedPermissionPriorityValue(string | int $existingValue, string | int $newValue, string $permissionType) : string | int
string
int
Existing value for the permission (int, or unset/allow/etc)
string
int
New value for the permission (int, unset/allow/etc)
string
"integer" or "flag"
string
int
Effective value for the 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.
string
Existing permission value (strings like unset, allow, deny, etc)
array
List of permission entries to look through. First key is group, second is permission ID.
string
Type of permission (integer or flag)
string
Permission Group ID to check
string
Permission ID to check
string
The permission this one depends on; if this permission is not active, this permission is ignored
string
New priority value_prepareCombinationUserGroupList(array $userGroupIds) : string
array
List of user group IDs
string
Comma delimited, sorted string of user group IDs_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.
integer
Modified by reference
integer
Modified by reference
_updatePermissionsForUserCollection(array $newPermissions, array $existingEntries, integer $userGroupId, integer $userId, string $dwName, array $bulkData) : boolean
array
Permissions to update, format: [permission_group_id][permission_id] => value
array
Existing permission entries for this collection
integer
integer
string
Name of the data writer to use to insert/update data
array
Bulk data to give to the datawriter
boolean
$_allowCachedRead : boolean
If not, it should be retrieved from the source.
inherited_from | \XenForo_Model::$$_allowCachedRead |
---|
$_cache : \Zend_Cache_Core | \Zend_Cache_Frontend
inherited_from | \XenForo_Model::$$_cache |
---|
$_db : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_Model::$$_db |
---|
$_localCacheData : array
This data is generally treated as canonical, even if {$_allowCachedRead} is false.
inherited_from | \XenForo_Model::$$_localCacheData |
---|
$_modelCache : array
inherited_from | \XenForo_Model::$$_modelCache |
---|