模块:Effective protection level:修订间差异
imported>Xiplus +JSON頁保護 |
imported>S8321414 Per request |
||
| (未显示3个用户的5个中间版本) | |||
| 第13行: | 第13行: | ||
end | end | ||
pagename = title.prefixedText | pagename = title.prefixedText | ||
if action == ' | if action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' and action ~= 'undelete' then | ||
error( 'First parameter must be one of edit, move, create, upload, undelete', 2 ) | |||
end | |||
if | if title.namespace == 8 then -- MediaWiki namespace | ||
return ' | if title.text:sub(-3) == '.js' or title.text:sub(-4) == '.css' or title.text == 'Gadgets-definition' or title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page | ||
elseif | return 'interfaceadmin' | ||
return | else -- any non-JS/CSS MediaWiki page | ||
return 'sysop' | |||
end | |||
elseif title.namespace == 2 and title.isSubpage then | |||
if title.contentModel == 'javascript' or title.contentModel == 'css' then -- user JS or CSS page | |||
return 'interfaceadmin' | |||
elseif title.contentModel == 'json' then -- user JSON page | |||
return 'sysop' | |||
end | end | ||
end | end | ||
if | if action == 'undelete' then | ||
return 'sysop' | return 'sysop' | ||
end | end | ||
| 第41行: | 第42行: | ||
local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move. | local blacklistentry = mw.ext.TitleBlacklist.test('edit', pagename) -- Testing action edit is correct, since this is for the source page. The target page name gets tested with action move. | ||
if blacklistentry and not blacklistentry.params.autoconfirmed then | if blacklistentry and not blacklistentry.params.autoconfirmed then | ||
return ' | return 'sysop' | ||
elseif title.namespace == 6 then | elseif title.namespace == 6 then | ||
return 'filemover' | return 'filemover' | ||
| 第53行: | 第54行: | ||
if blacklistentry then | if blacklistentry then | ||
if not blacklistentry.params.autoconfirmed then | if not blacklistentry.params.autoconfirmed then | ||
return ' | return 'sysop' | ||
elseif level == 'extendedconfirmed' then | elseif level == 'extendedconfirmed' then | ||
return 'extendedconfirmed' | return 'extendedconfirmed' | ||
| 第65行: | 第66行: | ||
elseif action == 'upload' then | elseif action == 'upload' then | ||
return 'autoconfirmed' | return 'autoconfirmed' | ||
else | else | ||
return '*' | return '*' | ||