「モジュール:Effective protection level」の版間の差分
細 1版 をインポートしました |
ja>Pppery Handle gadget page |
||
| 1行目: | 1行目: | ||
local p = {} | local p = {} | ||
-- Returns the permission required to perform a given action on a given title. | -- Returns the permission required to perform a given action on a given title. | ||
-- If no title is specified, the title of the page being displayed is used. | -- If no title is specified, the title of the page being displayed is used. | ||
| 24行目: | 23行目: | ||
end | end | ||
elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' and action ~= 'undelete' then | elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' and action ~= 'undelete' then | ||
error( ' | error( 'First parameter must be one of edit, move, create, upload, undelete, autoreview', 2 ) | ||
end | end | ||
if title.namespace == 8 then -- MediaWiki namespace | if title.namespace == 8 then -- MediaWiki namespace | ||
if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page | if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page | ||
return 'interfaceadmin' | |||
elseif title.baseText == "Gadgets-definition" then | |||
return 'interfaceadmin' | return 'interfaceadmin' | ||
else -- any non-JS/CSS MediaWiki page | else -- any non-JS/CSS MediaWiki page | ||
| 40行目: | 41行目: | ||
end | end | ||
if action == 'undelete' then | if action == 'undelete' then | ||
return | return 'sysop' | ||
end | end | ||
local level = title.protectionLevels[action] and title.protectionLevels[action][1] | local level = title.protectionLevels[action] and title.protectionLevels[action][1] | ||
| 54行目: | 55行目: | ||
return 'templateeditor' | return 'templateeditor' | ||
elseif title.namespace == 6 then | elseif title.namespace == 6 then | ||
return | return 'filemover' | ||
elseif level == 'extendedconfirmed' then | elseif level == 'extendedconfirmed' then | ||
return 'extendedconfirmed' | return 'extendedconfirmed' | ||
| 64行目: | 65行目: | ||
if blacklistentry then | if blacklistentry then | ||
if not blacklistentry.params.autoconfirmed then | if not blacklistentry.params.autoconfirmed then | ||
return | return 'templateeditor' | ||
elseif level == 'extendedconfirmed' then | elseif level == 'extendedconfirmed' then | ||
return 'extendedconfirmed' | return 'extendedconfirmed' | ||
| 76行目: | 77行目: | ||
elseif action == 'upload' then | elseif action == 'upload' then | ||
return 'autoconfirmed' | return 'autoconfirmed' | ||
elseif action == 'create' and title.namespace % 2 == 0 and title.namespace ~= 118 then -- You need to be registered, but not autoconfirmed, to create non-talk pages other than drafts | |||
if title.namespace == 0 then | |||
return 'autoconfirmed' -- Per [[WP:ACPERM]], you need to be autoconfirmed to create pages in mainspace | |||
end | |||
return 'user' | |||
else | else | ||
return '*' | return '*' | ||