15,076
edits
No edit summary |
(→修改 LocalSetting.php: add 關閉帳號註冊) |
||
| (23 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
{{Template:MediaWiki Installation}} | |||
This is partial translation of Meta:[http://meta.wikimedia.org/wiki/Setting_user_rights_in_MediaWiki Setting user rights in MediaWiki]. You may click the link for the latest information. Please notice that the '''translated/derivated content is available under [http://www.gnu.org/copyleft/fdl.html GNU Free Documentation License]''' which the same with the original work. | This is partial translation of Meta:[http://meta.wikimedia.org/wiki/Setting_user_rights_in_MediaWiki Setting user rights in MediaWiki]. You may click the link for the latest information. Please notice that the '''translated/derivated content is available under [http://www.gnu.org/copyleft/fdl.html GNU Free Documentation License]''' which the same with the original work. | ||
== 準備 == | == 準備 == | ||
* 支援Unicode的編輯器 for Windows:個人建議使用[http://notepad-plus.sourceforge.net/uk/site.htm Notepad Plus編輯器](under the GPL Licence) (其他選擇:[http://www.esperanto.mv.ru/UniRed/ENG/ UniRed - Unicode editor for Windows 95/98/NT/2000]) | * 支援Unicode的編輯器 for Windows:個人建議使用[http://notepad-plus.sourceforge.net/uk/site.htm Notepad Plus編輯器](under the GPL Licence) (其他選擇:[http://www.esperanto.mv.ru/UniRed/ENG/ UniRed - Unicode editor for Windows 95/98/NT/2000]) | ||
| Line 10: | Line 9: | ||
== 修改 LocalSetting.php == | == 修改 LocalSetting.php == | ||
將以下設定插入 LocalSetting.php | 將以下設定插入 LocalSetting.php | ||
{{Template:Wiki version | wiki_engine = MediaWiki | version = 1.15 }} | |||
=== | === 狀況A: 有登錄的使用者才能編輯頁面 === | ||
$wgGroupPermissions['*']['edit'] = false; | $wgGroupPermissions['*']['edit'] = false; | ||
#登錄的使用者才能編輯頁面,未登錄的訪客僅能觀看頁面內容 | |||
=== 狀況B: 匿名訪客僅能讀取部分頁面(wgWhitelistRead設定值),有登錄的使用者能讀取與編輯多數頁面 === | |||
<pre> | |||
$wgWhitelistRead = array( "Main Page", "Special:Userlogin", "Special:Recentchanges", "Help:Contents", "MediaWiki:Monobook.css" ); | |||
#設定匿名訪客僅能讀取的頁面名稱清單 | |||
= | $wgGroupPermissions['*' ]['createaccount'] = true; | ||
#設定匿名訪客能否註冊帳號,若要關閉註冊帳號,改為false | |||
$wgGroupPermissions['*' ]['read'] = false; | $wgGroupPermissions['*' ]['read'] = false; | ||
#設定匿名訪客能否讀取($wgWhitelistRead 白名單以外的)頁面 | |||
$wgGroupPermissions['*' ]['edit'] = false; | $wgGroupPermissions['*' ]['edit'] = false; | ||
#設定匿名訪客能否編輯頁面 | |||
</pre> | |||
=== 狀況C: 屬於managers的使用者才能觀看與編輯特定文章 === | |||
* | <pre> | ||
$wgGroupPermissions['*']['read'] = false; //設定未登入的匿名訪客,無法觀看任何頁面。 | |||
$wgGroupPermissions['user']['read'] = false; | |||
//設定登入的使用者,無法觀看任何頁面。除非是有在$wgWhitelistRead的頁面名稱清單內。 | |||
$wgWhitelistRead = array( "Main Page", "Special:Userlogin", "Special:UserLogout" ); | |||
//設定登入的匿名訪客 和 登入的使用者,僅能讀取的頁面名稱清單。 | |||
= MediaWiki 1.4+ = | $wgGroupPermissions['managers']['read'] = true; //設定managers群組的使用者,可以觀看(及編輯)所有頁面。 | ||
define("NS_OFFICIAL", 100); | |||
define("NS_OFFICIAL_TALK", 101); | |||
$wgExtraNamespaces = | |||
array(100 => "Official", | |||
101 => "Official_talk", | |||
); | |||
$wgNamespaceProtection[NS_OFFICIAL] = array( 'official-edit' ); | |||
$wgNamespaceProtection[NS_OFFICIAL_TALK] = array( 'official-talk-edit' ); | |||
$wgGroupPermissions['managers']['official-edit'] = true; //設定登入的managers群組的使用者,可以編輯Official namespace的頁面 (例如NS_OFFICIAL:page_name)。 | |||
$wgGroupPermissions['managers']['official-talk-edit'] = true; ////設定登入的managers群組的使用者,可以編輯Official namespace的討論頁面(例如Talk:NS_OFFICIAL:page_name)。 | |||
</pre> | |||
參考資料: | |||
# [http://www.mediawiki.org/wiki/Manual:$wgNamespaceProtection Manual:$wgNamespaceProtection - MediaWiki] | |||
# [http://www.mediawiki.org/wiki/Manual:Preventing_access#Restrict_viewing_of_all_pages Restrict viewing of all pages] | |||
=== 狀況D: 關閉帳號註冊 === | |||
<pre> | |||
$wgGroupPermissions['*']['createaccount'] = false; | |||
</pre> | |||
== MediaWiki 1.4+ == | |||
適用版本: MediaWIki 版本: 1.4 or older | 適用版本: MediaWIki 版本: 1.4 or older | ||
== 準備 == | === 準備 === | ||
* 支援Unicode的編輯器 | * 支援Unicode的編輯器 | ||
* 請記得文件格式編譯成'''UTF-8(無BOM)'''。 | * 請記得文件格式編譯成'''UTF-8(無BOM)'''。 | ||
== 修改 LocalSetting.php == | === 修改 LocalSetting.php === | ||
將以下設定插入 LocalSetting.php | 將以下設定插入 LocalSetting.php | ||
<pre> | <pre> | ||
| Line 70: | Line 110: | ||
$wgWhitelistRead = array ("共筆首頁", "特殊:Userlogin", "維基百科:幫助", "Help"); | $wgWhitelistRead = array ("共筆首頁", "特殊:Userlogin", "維基百科:幫助", "Help"); | ||
== | == 相關資料 == | ||
* [http://planetoid.info/weblog/2005/10/10/000521.html 與Wiki Spam bot奮戰] (適用版本: MediaWiki v1.4.x) | * [http://planetoid.info/weblog/2005/10/10/000521.html 與Wiki Spam bot奮戰] (適用版本: MediaWiki v1.4.x) | ||
* [http://www.mediawiki.org/wiki/Manual:User_rights Manual:User rights - MediaWiki] {{access | date = 2011-02-26 }} | |||
** [http://www.mediawiki.org/wiki/Manual:Preventing_access Manual:Preventing access - MediaWiki] | |||
** [http://www.mediawiki.org/wiki/Manual:User_rights_management Manual:User rights management - MediaWiki] | |||
* [http://www.mediawiki.org/wiki/Category:User_rights_extensions Category:User rights extensions - MediaWiki] | |||
[[Category:MediaWiki]] [[Category:AntiSpam]] | |||