Editing
Setting user rights in MediaWiki
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== 修改 LocalSetting.php == 將以下設定插入 LocalSetting.php {{Template:Wiki version | wiki_engine = MediaWiki | version = 1.15 }} === 狀況A: 有登錄的使用者才能編輯頁面 === $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; #設定匿名訪客能否讀取($wgWhitelistRead 白名單以外的)頁面 $wgGroupPermissions['*' ]['edit'] = false; #設定匿名訪客能否編輯頁面 </pre> === 狀況C: 屬於managers的使用者才能觀看與編輯特定文章 === <pre> $wgGroupPermissions['*']['read'] = false; //設定未登入的匿名訪客,無法觀看任何頁面。 $wgGroupPermissions['user']['read'] = false; //設定登入的使用者,無法觀看任何頁面。除非是有在$wgWhitelistRead的頁面名稱清單內。 $wgWhitelistRead = array( "Main Page", "Special:Userlogin", "Special:UserLogout" ); //設定登入的匿名訪客 和 登入的使用者,僅能讀取的頁面名稱清單。 $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>
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information