Manual:user_groups テーブル
↑ Manual:コンテンツ | MediaWiki のデータベース レイアウト | user_groups テーブル |
MediaWiki バージョン: | ≧ 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. MediaWiki 1.3または1.4を使用している場合、Manual:User rights (older versions) を参照ください。 MediaWiki 1.5より前のバージョンでは、利用者権限はuser テーブルのuser_rights フィールドにありました。
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
, or autoconfirmed
are not stored in this table. To retrieve all effective groups use UserGroupManager::getUserEffectiveGroups()
.
フィールド
ug_user
このフィールドは、指定利用者のuser_id にリンクします。 It is a foreign key used to link accounts with their assigned privileges.
ug_group
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 one row for each (explicit) group the user is in.
ug_expiry
MediaWiki バージョン: | ≧ 1.29 |
This field stores a user group's expiry time. It is similar to pr_expiry in the page_restrictions table and ipb_expiry in the ipblocks table.
スキーマの要約
MediaWiki バージョン: | ≧ 1.29 |
DESCRIBE user_groups;
+-----------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+------------------+------+-----+---------+-------+ | ug_user | int(10) unsigned | NO | PRI | 0 | | | ug_group | varbinary(255) | NO | PRI | | | | ug_expiry | varbinary(14) | YES | MUL | NULL | | +-----------+------------------+------+-----+---------+-------+
MediaWiki バージョン: | 1.21 – 1.28 |
DESCRIBE user_groups;
+----------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+------------------+------+-----+---------+-------+ | ug_user | int(10) unsigned | NO | PRI | 0 | | | ug_group | varbinary(255) | NO | PRI | | | +----------+------------------+------+-----+---------+-------+
MediaWiki バージョン: | 1.19 – 1.20 |
DESCRIBE user_groups;
+----------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+------------------+------+-----+---------+-------+ | ug_user | int(10) unsigned | NO | PRI | 0 | | | ug_group | varbinary(32) | NO | PRI | | | +----------+------------------+------+-----+---------+-------+
MediaWiki バージョン: | 1.10 – 1.18 |
DESCRIBE user_groups;
+----------+------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+------------------+------+-----+---------+-------+ | ug_user | int(10) unsigned | NO | PRI | 0 | | | ug_group | varbinary(16) | NO | PRI | | | +----------+------------------+------+-----+---------+-------+
MediaWiki バージョン: | 1.5 – 1.9 |
DESCRIBE user_groups;
+----------+-----------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-----------------+------+-----+---------+-------+ | ug_user | int(5) unsigned | NO | PRI | 0 | | | ug_group | char(16) | NO | PRI | | | +----------+-----------------+------+-----+---------+-------+
インデックス
MediaWiki バージョン: | ≧ 1.29 |
SHOW INDEX IN user_groups;
+-------------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | +-------------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ | user_groups | 0 | PRIMARY | 1 | ug_user | A | 0 | NULL | NULL | | BTREE | | | | user_groups | 0 | PRIMARY | 2 | ug_group | A | 0 | NULL | NULL | | BTREE | | | | user_groups | 1 | ug_group | 1 | ug_group | A | 0 | NULL | NULL | | BTREE | | | | user_groups | 1 | ug_expiry | 1 | ug_expiry | A | 0 | NULL | NULL | YES | BTREE | | | +-------------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
既定の MediaWiki グループ
In a default MediaWiki installation, ug_group can be one of the following:
SELECT DISTINCT `ug_group` FROM `user_groups`;
+------------+ | ug_group | +------------+ | bot | | bureaucrat | | sysop | +------------+