MediaWiki Javascript Config to get Restriction type

javascript
api
gadgets

#1

On https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#Page-specific, There is two mw.config for check page protection level, First one is wgIsProbablyEditable, which true or false. The Second one is wgRestrictionEdit, which return the array of the group. which can edit the page. But I want to also know which kind of protection level is. If a page is protected due to Cascading protection. So How can I take this in javascript?

Also:- https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=info&titles=Template%3AConvert&inprop=protection is not giving Restriction cause. Thanks in advance :slight_smile:


#2

Apparently, there’s no way to tell from JavaScript variables if a page is affected by cascading protection, This makes sense, because that’s probably expensive and that’s why the wgIsProbablyEditable is in place.

Protection reason is not exposed from the api. Since the normal interface exposes it in Special:ProtectedPages, I guess it would be sensible to expose it also from the api


#3

Thanks :slight_smile: