Extension talk:PageProtection/Sourcecode (Jonabbey)

From mediawiki.org
Latest comment: 17 years ago by Jonabbey in topic Bottom Line
The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).

Section Problems[edit]

One problem with this code as it appears here is that there is no protection against editing sections that are contained in a <protect-edit> region. Because such sections are visible, MediaWiki will show the edit section link, which will cause the protectedEdit function to be called on the text within that section, which bypasses the <protect-edit> that surround such sections.

The protectedEdit function needs to be able to determine whether the requested section is contained in the bounds of a <protect-edit> section, or we need to be able to inhibit the edit section action from being available for such sections.

It's not clear that we could do either reasonably, or if we did, how best to do it.

I need to investigate more into the MediaWiki structure.

Jonabbey 21:15, 17 May 2006 (UTC)Reply

Section Solutions[edit]

Okay, the version currently up makes it so that <protect-edit> anywhere on the page causes the entire page to be restricted-edit. Editing a section directly no longer bypasses protection.

Unfortunately, this makes it so that you can't have certain sections of a page non-editable with other sections editable. That would require a function that could identify what sections were in a <protect-edit> section and which ones were not, which would take a bit of doing.. especially because the <protect-edit> sections could partially overlap one or more sections.

Jonabbey 22:58, 17 May 2006 (UTC)Reply

Bottom Line[edit]

Really, this means that the only use of <protect-edit> is to provide a more fine-grained page protection in the Wiki, as you can allow a designated user or group to edit a page, rather than just the sysop/no sysop choice of the built in page protect function that sysops can use.

It may be better just not to try and use this <protect-edit> modified version of Page Protection, as it removes the ability to have a simple edit/view <protect> tag around a subset of page without interfering with editing of the rest of the page.

On the other hand, I'm not convinced that the original code really does support <protect> around part of a page in a meaningful way, as I believe it is always possible to craft a direct section URL to gain editing access, bypassing the <protect>.

Jonabbey 23:30, 17 May 2006 (UTC)Reply