如何在mediawiki中创建自己的自定义组?

时间:2022-11-13 01:22:13

I have been reading carefully through the mediawiki documentation but I have not been able to find out how to create new groups.

我一直在仔细阅读mediawiki文档但我无法找到如何创建新组。

When I look at Special:Userrights, I see only 3 groups : Bots, Sysops, Bureaycrats

当我看到Special:Userrights时,我只看到3组:Bots,Sysops,Bureaycrats

I would like to create my own custom groups, so I can use some extensions like the http://www.mediawiki.org/wiki/Extension:Group_Based_Access_Control.

我想创建自己的自定义组,所以我可以使用一些扩展,如http://www.mediawiki.org/wiki/Extension:Group_Based_Access_Control。

Can someone tell me how it's done, or point me to some documentation?

有人可以告诉我它是如何完成的,或者指向我一些文档?

5 个解决方案

#1


57  

You can add permissions for new groups to your LocalSettings.php file and they will automatically appear in the Special:UserRights page.

您可以将新组的权限添加到LocalSettings.php文件中,它们将自动显示在Special:UserRights页面中。

For example, I wanted to disallow editing by regular users but create a "Trusted" group that was allowed to edit. The following code creates a "Trusted" group that is equal to the "user" group, except that "Trusted" users can edit but "user" users cannot.

例如,我想禁止普通用户编辑,但创建一个允许编辑的“受信任”组。以下代码创建一个“受信任”组,该组等于“用户”组,但“受信任”用户可以编辑但“用户”用户不能编辑。

$wgGroupPermissions['Trusted'] = $wgGroupPermissions['user'];
$wgGroupPermissions['user'   ]['edit']          = false;
$wgGroupPermissions['Trusted']['edit']          = true;
$wgGroupPermissions['sysop'  ]['edit']          = true;

On the Special:UserRights page, I can now check the "Trusted" box to make users trusted.

在Special:UserRights页面上,我现在可以查看“受信任”框以使用户信任。

#2


6  

You can alter the appearance of the group name by creating the following messages: (For a group named ninja:)

您可以通过创建以下消息来更改组名的外观:(对于名为ninja的组:)

  • MediaWiki:Group-ninja (content: Ninjas)
  • MediaWiki:Group-ninja(内容:Ninjas)

  • MediaWiki:Group-ninja-member (content: ninja)
  • MediaWiki:Group-ninja-member(内容:ninja)

  • MediaWiki:Grouppage-ninja (content: Project:Ninjas)
  • MediaWiki:Grouppage-ninja(内容:项目:Ninjas)

This will insure that the group will be referred to as "Ninjas" throughout the interface, and a member will be referred to as a "ninja", and overviews will link the groupname to Project:Ninjas.

这将确保该组在整个界面中被称为“Ninjas”,并且一名成员将被称为“忍者”,并且概述将该组名称链接到Project:Ninjas。

(source: http://www.mediawiki.org/wiki/Manual:User_rights#Examples)

#3


2  

Here you will find a List of Permissions. http://www.mediawiki.org/wiki/Manual:User_rights

在这里,您将找到权限列表。 http://www.mediawiki.org/wiki/Manual:User_rights

#4


1  

I beleive I have found the answer, I just need to add the UserGroup and the permission to the wgGroupPermissions array in the LocalSettings.php file.

我相信我找到了答案,我只需要在LocalSettings.php文件中添加UserGroup和权限到wgGroupPermissions数组。

$wgGroupPermissions['TomatoUsers']['read']  = true;
$wgGroupPermissions['TomatoUsers']['edit']  = false;

#5


1  

I don't have the reputation to vote up the first answer (which can also be added to extension initialization files), but for when you get to adding users to your groups you may want to consider directly editing the database (ie. if you need to sync the wiki groups with external information). If you open the database "wikidb" the "PREFIX_user_groups"* table contains the mapping between user IDs (ug_user) and group names (ug_group). This table, combined with the "PREFIX_user"* table's name information (user_name) and ID information (user_id), give you all the information to add and remove large numbers of users from groups.

我没有声誉投票给第一个答案(也可以添加到扩展程序初始化文件中),但是当您将用户添加到组时,您可能需要考虑直接编辑数据库(即,如果您需要将wiki组与外部信息同步)。如果打开数据库“wikidb”,则“PREFIX_user_groups”*表包含用户ID(ug_user)和组名(ug_group)之间的映射。此表与“PREFIX_user”*表的名称信息(user_name)和ID信息(user_id)相结合,为您提供了从组中添加和删除大量用户的所有信息。

* Replace "PREFIX" with the database prefix you used for your wiki.

*将“PREFIX”替换为您用于Wiki的数据库前缀。

#1


57  

You can add permissions for new groups to your LocalSettings.php file and they will automatically appear in the Special:UserRights page.

您可以将新组的权限添加到LocalSettings.php文件中,它们将自动显示在Special:UserRights页面中。

For example, I wanted to disallow editing by regular users but create a "Trusted" group that was allowed to edit. The following code creates a "Trusted" group that is equal to the "user" group, except that "Trusted" users can edit but "user" users cannot.

例如,我想禁止普通用户编辑,但创建一个允许编辑的“受信任”组。以下代码创建一个“受信任”组,该组等于“用户”组,但“受信任”用户可以编辑但“用户”用户不能编辑。

$wgGroupPermissions['Trusted'] = $wgGroupPermissions['user'];
$wgGroupPermissions['user'   ]['edit']          = false;
$wgGroupPermissions['Trusted']['edit']          = true;
$wgGroupPermissions['sysop'  ]['edit']          = true;

On the Special:UserRights page, I can now check the "Trusted" box to make users trusted.

在Special:UserRights页面上,我现在可以查看“受信任”框以使用户信任。

#2


6  

You can alter the appearance of the group name by creating the following messages: (For a group named ninja:)

您可以通过创建以下消息来更改组名的外观:(对于名为ninja的组:)

  • MediaWiki:Group-ninja (content: Ninjas)
  • MediaWiki:Group-ninja(内容:Ninjas)

  • MediaWiki:Group-ninja-member (content: ninja)
  • MediaWiki:Group-ninja-member(内容:ninja)

  • MediaWiki:Grouppage-ninja (content: Project:Ninjas)
  • MediaWiki:Grouppage-ninja(内容:项目:Ninjas)

This will insure that the group will be referred to as "Ninjas" throughout the interface, and a member will be referred to as a "ninja", and overviews will link the groupname to Project:Ninjas.

这将确保该组在整个界面中被称为“Ninjas”,并且一名成员将被称为“忍者”,并且概述将该组名称链接到Project:Ninjas。

(source: http://www.mediawiki.org/wiki/Manual:User_rights#Examples)

#3


2  

Here you will find a List of Permissions. http://www.mediawiki.org/wiki/Manual:User_rights

在这里,您将找到权限列表。 http://www.mediawiki.org/wiki/Manual:User_rights

#4


1  

I beleive I have found the answer, I just need to add the UserGroup and the permission to the wgGroupPermissions array in the LocalSettings.php file.

我相信我找到了答案,我只需要在LocalSettings.php文件中添加UserGroup和权限到wgGroupPermissions数组。

$wgGroupPermissions['TomatoUsers']['read']  = true;
$wgGroupPermissions['TomatoUsers']['edit']  = false;

#5


1  

I don't have the reputation to vote up the first answer (which can also be added to extension initialization files), but for when you get to adding users to your groups you may want to consider directly editing the database (ie. if you need to sync the wiki groups with external information). If you open the database "wikidb" the "PREFIX_user_groups"* table contains the mapping between user IDs (ug_user) and group names (ug_group). This table, combined with the "PREFIX_user"* table's name information (user_name) and ID information (user_id), give you all the information to add and remove large numbers of users from groups.

我没有声誉投票给第一个答案(也可以添加到扩展程序初始化文件中),但是当您将用户添加到组时,您可能需要考虑直接编辑数据库(即,如果您需要将wiki组与外部信息同步)。如果打开数据库“wikidb”,则“PREFIX_user_groups”*表包含用户ID(ug_user)和组名(ug_group)之间的映射。此表与“PREFIX_user”*表的名称信息(user_name)和ID信息(user_id)相结合,为您提供了从组中添加和删除大量用户的所有信息。

* Replace "PREFIX" with the database prefix you used for your wiki.

*将“PREFIX”替换为您用于Wiki的数据库前缀。