MediaWiki master
MediaWiki\Permissions\GroupPermissionsLookup Class Reference

A service class for looking up permissions bestowed to groups, groups bestowed with permissions, and permissions bestowed by membership in a combination of groups, solely according to site configuration for group permissions and inheritance thereof. More...

Public Member Functions

 __construct (ServiceOptions $options)
 getGrantedPermissions (string $group)
 Get a list of permissions granted to this group.
 getGroupPermissions (array $groups)
 Get the permissions associated with membership in a combination of groups.
 getGroupsWithPermission (string $permission)
 Get all the groups who have a given permission.
 getRevokedPermissions (string $group)
 Get a list of permissions revoked from this group.
 groupHasPermission (string $group, string $permission)
 Check, if the given group has the given permission.

Public Attributes

const CONSTRUCTOR_OPTIONS

Detailed Description

A service class for looking up permissions bestowed to groups, groups bestowed with permissions, and permissions bestowed by membership in a combination of groups, solely according to site configuration for group permissions and inheritance thereof.

This class does not account for implicit rights (which are not associated with groups). Callers might want to use {

See also
PermissionManager} if this is an issue.

This class does not infer membership in one group (e.g. '*') from membership in another (e.g. 'user'). Callers must account for this when using {

See also
self::getGroupPermissions()}.
Since
1.36

Definition at line 25 of file GroupPermissionsLookup.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ getGrantedPermissions()

MediaWiki\Permissions\GroupPermissionsLookup::getGrantedPermissions ( string $group)

Get a list of permissions granted to this group.

This must NOT be used for permissions checking as it does not check whether a permission has been revoked from this group.

Parameters
string$groupGroup to get permissions of
Returns
string[]
Since
1.38

Definition at line 100 of file GroupPermissionsLookup.php.

◆ getGroupPermissions()

MediaWiki\Permissions\GroupPermissionsLookup::getGroupPermissions ( array $groups)

Get the permissions associated with membership in a combination of groups.

Group-based revocation of a permission negates all group-based assignments of that permission.

Parameters
string[]$groupsinternal group names
Returns
string[] permission key names for given groups combined

Definition at line 144 of file GroupPermissionsLookup.php.

◆ getGroupsWithPermission()

MediaWiki\Permissions\GroupPermissionsLookup::getGroupsWithPermission ( string $permission)

Get all the groups who have a given permission.

Parameters
string$permission
Returns
string[] internal group names with the given permission

Definition at line 184 of file GroupPermissionsLookup.php.

References groupHasPermission().

◆ getRevokedPermissions()

MediaWiki\Permissions\GroupPermissionsLookup::getRevokedPermissions ( string $group)

Get a list of permissions revoked from this group.

Parameters
string$groupGroup to get revoked permissions of
Returns
string[]
Since
1.38

Definition at line 121 of file GroupPermissionsLookup.php.

◆ groupHasPermission()

MediaWiki\Permissions\GroupPermissionsLookup::groupHasPermission ( string $group,
string $permission )

Check, if the given group has the given permission.

If you're wanting to check whether all users have a permission, use PermissionManager::isEveryoneAllowed() instead. That properly checks if it's revoked from anyone.

Parameters
string$groupGroup to check
string$permissionRole to check
Returns
bool

Definition at line 64 of file GroupPermissionsLookup.php.

Referenced by getGroupsWithPermission().

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Permissions\GroupPermissionsLookup::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const GroupInheritsPermissions
Name constant for the GroupInheritsPermissions setting, for use with Config\get().
const RevokePermissions
Name constant for the RevokePermissions setting, for use with Config\get().
const GroupPermissions
Name constant for the GroupPermissions setting, for use with Config\get().
Access: internal

Definition at line 30 of file GroupPermissionsLookup.php.


The documentation for this class was generated from the following file: