Manual:User groups table
Language: | English • 日本語 |
---|
↑ Manual:Contents | MediaWiki database layout | user_groups table |
MediaWiki version: | ≥ 1.5 |
The user_groups table maps the users in a particular MediaWiki installation to their corresponding user rights. Each group can be assigned a mixture of permissions through LocalSettings.php or via extensions; all users of a particular group have those permissions granted to them as a result of their membership in the group. As the table is separate from the user table, this allows for the creation of a shared user database with permissions that vary from wiki to wiki within a wiki farm. This table was introduced on r5648, in MediaWiki 1.5. If you are using MediaWiki 1.3 or 1.4, have a look at Manual:User rights (older versions). Before MediaWiki 1.5, user rights were stored in the the user_rights field of the user table.
All unregistered users automatically belong to the '*'
group and only to that group; all registered users additionally are automatically part of the 'user'
group. User groups are additive; as a result, all registered users have all the privileges assigned to the '*'
group as well. Formerly there was a "sysop bit"; now, making a user a sysop adds a row to user_groups
.
User::getEffectiveGroups()
.Fields[edit | edit source]
ug_user[edit | edit source]
This field links to a given user's user_id. It is a foreign key used to link accounts with their assigned privileges.
ug_group[edit | edit source]
This field stores the user's permissions, which are stored as groups. At runtime, $wgGroupPermissions will associate group keys with particular permissions; a user will have the combined permissions of any group they're explicitly in, plus the implicit '*'
and 'user'
groups. Example ug_group
values: 'bot', 'bureaucrat', 'sysop'.
There is a row for each (explicit) group the user is in.
Schema summary[edit | edit source]
MediaWiki version: | 1.21 |
mysql> describe user_groups; +----------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+------------------+------+-----+---------+-------+ | ug_user | int(10) unsigned | NO | PRI | 0 | | | ug_group | varbinary(255) | NO | PRI | | | +----------+------------------+------+-----+---------+-------+ 2 rows in set (0.00 sec)
MediaWiki version: | 1.19 |
mysql> describe user_groups; +----------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+------------------+------+-----+---------+-------+ | ug_user | int(10) unsigned | NO | PRI | 0 | | | ug_group | varbinary(32) | NO | PRI | | | +----------+------------------+------+-----+---------+-------+
MediaWiki version: | 1.18 |
DESCRIBE user_groups in MediaWiki 1.18 gives the following:
+----------+-----------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-----------------+------+-----+---------+-------+ | ug_user | int(5) unsigned | NO | PRI | 0 | | | ug_group | varbinary(16) | NO | PRI | NULL | | +----------+-----------------+------+-----+---------+-------+
MediaWiki version: | 1.5 |
DESCRIBE user_groups in MediaWiki 1.5-1.9 gives the following:
+----------+-----------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-----------------+------+-----+---------+-------+ | ug_user | int(5) unsigned | NO | PRI | 0 | | | ug_group | char(16) | NO | PRI | NULL | | +----------+-----------------+------+-----+---------+-------+
Default MediaWiki groups[edit | edit source]
In a default MediaWiki installation, ug_group can be one of the following :
query : SELECT DISTINCT ug_group FROM user_groups; +------------+ | ug_group | +------------+ | bot | | bureaucrat | | sysop | +------------+
![]() |
Engines: MySQL – Oracle – PostgreSQL – SQLite Technical documentation: Schema (tables) – API property associations – Field prefixes – Primary key storage in other fields – Wikimedia extension tables Configuration: Settings – Sharing Development: Access – Optimization – Policy – Updater – Extension schema updates – Patch file Core tables: archive – category – categorylinks – change_tag – config – externallinks – filearchive – hitcounter – image – imagelinks – interwiki – iwlinks – ipblocks – job – l10n_cache – langlinks – logging – log_search – msg_resource – msg_resource_links – module_deps – objectcache – oldimage – page – pagelinks – page_props – page_restrictions – protected_titles – querycache – querycachetwo – querycache_info – recentchanges – redirect – revision – searchindex – sites – site_stats – tag_summary – templatelinks – text – transcache – updatelog – uploadstash – user – user_former_groups – user_groups – user_newtalk – user_properties – valid_tag – watchlist |
---|