For faster navigation, this Iframe is preloading the Wikiwand page for มอดูล:Effective protection level.

มอดูล:Effective protection level

Documentation icon คู่มือการใช้งานมอดูล[ดู] [แก้] [ประวัติ] [ล้างแคช]

มอดูลนี้ส่งคืนกลุ่มผู้ใช้ที่สามารถกระทำสิ่งใด ๆ ในหน้าได้ ผลลัพท์ปัจจุบันเป็นดังนี้

  • แม่แบบและมอดูล: autoconfirmed
  • หน้าในเนมสเปซมีเดียวิกิ: sysop
  • หน้าที่เป็นหน้ารองสไตล์ชีตและจาวาสคริปต์ของผู้ใช้: interfaceadmin
  • หน้าที่เป็นหน้ารอง JSON ของผู้ใช้: sysop
  • หน้าที่ถูกป้องกัน: sysop หรือ autoconfirmed
  • หน้าที่ถูกป้องกันแบบต่อเรียง: sysop
  • ชื่อหน้าตรงกับบัญชีดำ: sysop
  • การย้ายไฟล์: uploader หรือ sysop
  • อัปโหลดไฟล์: uploader หรือ sysop
  • อื่น ๆ: * (ทุกคน)

การใช้งาน

[แก้]

ระวัง: มอดูลนี้ใช้งานตัวแจงส่วนที่อาจก่อปัญหาแก่เซิร์ฟเวอร์ถึง 4 ตัวในแต่ละครั้งที่เรียกใช้ โดยจะใช้มอดูลนี้เมื่อจำเป็นเท่านั้น หากไม่จำเป็นขนาดนั้นกรุณาเปลี่ยนไปใช้ title.protectionLevels แทน

จากมอดูลอื่น

[แก้]

ใช้:

local effectiveProtectionLevel = require('Module:Effective protection level')._main

The function accepts two parameters. The first is a string containing the action to check, which must be one of "edit", "create", "move", "upload", or "autoreview". The second is optional, and can either be the name of the page to check, or a title returned from the mw.title functions. If the second parameter is omitted, the page being displayed is the one checked against. The return value is a string containing the name of the group required to perform the given action.

From wikitext

[แก้]

The parameters are the same as when it is called directly.

แม่แบบ:Tlinv

See also

[แก้]

local p = {}

-- 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.
function p._main(action, pagename)
	local title
	if type(pagename) == 'table' and pagename.prefixedText then
		title = pagename
	elseif pagename then
		title = mw.title.new(pagename)
	else
		title = mw.title.getCurrentTitle()
	end
	pagename = title.prefixedText

	if action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then
		error( 'First parameter must be one of edit, move, create, upload', 2 )
	end
	if title.namespace == 8 then -- MediaWiki namespace
		if title.contentModel == 'javascript' or title.contentModel == 'css' then -- site JS or CSS page
			return 'interfaceadmin'
		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
	local level = title.protectionLevels[action] and title.protectionLevels[action][1]
	if level == 'sysop' or level == 'editprotected' then
		return 'sysop'
	elseif title.cascadingProtection.restrictions[action] and title.cascadingProtection.restrictions[action][1] then -- used by a cascading-protected page
		return 'sysop'
	elseif action == 'move' then
		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
			return 'autocomfirmed'
		end
	end
	local blacklistentry = mw.ext.TitleBlacklist.test(action, pagename)
	if blacklistentry then
		return 'autoconfirmed'
	elseif level == 'editsemiprotected' then -- create-semiprotected pages return this for some reason
		return 'autoconfirmed'
	elseif level then
		return level
	elseif action == 'upload' then
		return 'uploader'
	else
		return '*'
	end
end

setmetatable(p, { __index = function(t, k)
	return function(frame)
		return t._main(k, frame.args[1])
	end
end })

return p
{{bottomLinkPreText}} {{bottomLinkText}}
มอดูล:Effective protection level
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?