Extension talk:Lockdown

From MediaWiki.org
Jump to: navigation, search
Start a new discussion

Contents

Thread titleRepliesLast modified
On using the $wgSpecialPageLockdown018:19, 28 October 2014
lockdown for Special namespace218:10, 28 October 2014
Restrict createpage-right in Project-Namespace222:50, 27 October 2014
This extension is not working for me217:38, 27 October 2014
Hide Sidebar Menu Items for locked down pages216:23, 27 October 2014
Lockdown extension developer needed for grant209:46, 27 April 2014
Lockdown and VisualEditor - can't edit protected pages019:24, 19 February 2014
Working in MediaWiki 1.23wmf11315:44, 7 February 2014
Not working in Mediawiki 1.21014:20, 21 January 2014
update extension113:13, 12 January 2014
Locking everything down completely except reading the Main Namespace001:53, 17 August 2013
block edit access to user page - except for admins?206:00, 30 July 2013
Is it working for mw 1.19 ?011:29, 28 July 2013
Making lockdown function022:44, 22 March 2013
Update Credits (for Special:Version)021:58, 16 March 2013
Works with 1.19.1015:14, 25 January 2013
Lockdown preventing users resetting their password017:15, 29 November 2012
Problem with mw 1.17311:10, 30 August 2012
Locking down special pages203:45, 23 July 2012
First page
First page
Previous page
Previous page
Last page
Last page

On using the $wgSpecialPageLockdown

I don't think it was mentioned in the README file, but one should be careful about specifying the page name when using $wgSpecialPageLockdown. Say I want to block read access to Special:UncategorizedCategories, then I would naturally do something like this:

$wgSpecialPageLockdown['UncategorizedCategories'] = array('bureaucrat');

This is incorrect. You need to replace 'UncategorizedCategories' with 'Uncategorizedcategories'.

This is true for every special page with a title being the concatenation of two or more words such as 'UncategorizedCategories' above.

Mfort123 (talk)18:19, 28 October 2014

lockdown for Special namespace

It is possible to lockdown the special namespace? I do not want users having access to the Special namespace, so I wrote this in LocalSettings.php:

$wgNamespacePermissionLockdown[NS_SPECIAL]['read'] = array('bureaucrat');

I seem to be able to access special pages through a user that is not in group bureaucrat.

Mfort123 (talk)03:47, 28 October 2014

It does not make sense to do this. Logging into or out of a wiki already requires access to special pages. I suggest to lock down only selected special pages.

[[kgh]] (talk)09:22, 28 October 2014

My plan was to put the login,logout and other specific special pages in the $wgWhitelistRead array and then block the Special namespace. Then all the special pages would be blocked to users except a few of them (like login and logout). This approach doesn't seem to work.

I've never studied the php language, but I was able to look at the Lockdown.php file and make sense of it. For my needs, I ended up commenting out the part where pages specified in the $wgWhitelistRead array cannot be denied read acces.

Mfort123 (talk)18:10, 28 October 2014
 
 

Restrict createpage-right in Project-Namespace

Hello, what's the right way to restrict the right to create a page in the Project-namespace (NS_PROJECT) to a certain group, but allow all other to edit them.

I tried this:

$wgGroupPermissions['*']['edit'] = true;
$wgNamespacePermissionLockdown[NS_PROJECT]['createpage'] = array('sysop');

But it wont work. Still every logged in user can create pages in the project namespace.

Finswimmer (talk)15:51, 4 March 2014

Did you ever get this to work?

76.68.137.4506:33, 27 October 2014

Hmm... , I do not think this can be done since action "edit" includes action "createpage" (some sort of "rights inheritance"). However, I may still be proven wrong.

[[kgh]] (talk)22:49, 27 October 2014
 
 

This extension is not working for me

  • I'm using mediawiki 1.23 on Fedora
  • I created a namespace called "project".
  • I properly installed the extension (checked Special:Version).
  • I put this in the LocalSettings.php file:

$wgNamespacePermissionLockdown[NS_PROJECT]['*'] = array('sysop');

  • I created a page at project:AA
  • I can still access the page project:AA from a non sysop user.

It appears that this extension is no longer functional. Any ideas?

76.68.137.4506:31, 27 October 2014

The extension works for me.

About the project namespace, see $wgMetaNamespace.

Shirayuki (talk)07:14, 27 October 2014

I figured out why it wasn't working. I just realised that once I put a page in the $wgWhitelistRead array then I can't disable read access to that page through this extension.

Mfort123 (talk)17:38, 27 October 2014
 
 

Hide Sidebar Menu Items for locked down pages

I've successfully implemented the Lockdown extension to prevent pages from being accessed. However, the links that the user cannot access are still shown in the Sidebar.

Is there a way to remove links from the sidebar? (i.e. can I hide links based on the pages they point to that are part of namespaces that are not able to be accessed by the current logged in user?)

50.32.27.23415:22, 3 March 2014

Do you mind sharing how you got this to work?

76.68.137.4506:33, 27 October 2014

Well, this IP did not get it to work. I believe the UserFunctions extension is the best way to display per group links in the sidebar.

[[kgh]] (talk)16:23, 27 October 2014
 
 

Lockdown extension developer needed for grant

See idea at m:Grants:IdeaLab/A place to work together.

  • If you'd like to develop the Lockdown extension, you may get a few thousands dollars to do it.
  • If you use the Lockdown extension, please document in bugzilla reports what's missing for it to satisfy the requirements.

(Also posted on mediawiki-l.)

Nemo09:11, 26 April 2014

Nemo, I've done a bit of work in using lockdown.

See: Extension:NSFileRepo

jdpond (talk)11:49, 26 April 2014

You're free to edit the idea on Meta, add yourself as participant and then (if you wish) bring it up as actual (IEG) grant request, ideally together with some more participants. :)

Nemo09:46, 27 April 2014
 
 

Lockdown and VisualEditor - can't edit protected pages

I have a wiki running 1.23wmf11 and the latest build of VisualEditor, the WYSIWYG editor from Wikimedia. It uses a node.js-based parser to round-trip wikitext called Parsoid.

I have defined a few custom name spaces and enabled VisualEdtior for those name spaces. Everything is working as intended.

If I use $wgNamespacePermissionLockdown to define read and edit rights for user groups VisualEditor does not work.

Instead I'm prompted with a "Error loading data from server: parsoidserver-http-bad-status: 500."

Editing the page with WikiEditor works as intended.

node spits out the following when the attempt to edit is made.

starting parsing of localhost:DBC:Cache_Shadowing_Stop/Start_Suspend/Resume
 ERROR in localhost:DBC:Cache_Shadowing_Stop/Start_Suspend/Resume with oldid: 123915
 Stack trace: Error: API response is missing query for: DBC:Cache_Shadowing_Stop/Start_Suspend/Resume
  at TemplateRequest._handleJSON (/var/www/Parsoid/lib/mediawiki.ApiRequest.js:270:11)
  at TemplateRequest.ApiRequest._handleBody (/var/www/Parsoid/lib/mediawiki.ApiRequest.js:192:7)
  at TemplateRequest.ApiRequest._requestCB (/var/www/Parsoid/lib/mediawiki.ApiRequest.js:149:8)
  at Request.self.callback (/var/www/Parsoid/node_modules/request/request.js:129:22)
  at Request.EventEmitter.emit (events.js:98:17)
  at Request.<anonymous> (/var/www/Parsoid/node_modules/request/request.js:873:14)
  at Request.EventEmitter.emit (events.js:117:20)
  at IncomingMessage.<anonymous> (/var/www/Parsoid/node_modules/request/request.js:824:12)
  at IncomingMessage.EventEmitter.emit (events.js:117:20)
  at _stream_readable.js:920:16

It sounds like the Lockdown extension is somehow getting in the way of Parsoid and the MediaWiki api to make it's calls.

While VisualEditor is not the default editor for MediaWiki, its active development and future roadmap seem to indicate that it will be a preferred way to edit wiki pages for many editors. Any inputs and thoughts would be appreciated.

Ckoerner (talk)19:24, 19 February 2014

Working in MediaWiki 1.23wmf11

The trick it seems to get this extension to work is to ensure that your "$wgNamespacePermissionLockdown" config is beneath the 'require_once'.

Example:

#Enable Lockdown
require_once __DIR__ . "/extensions/Lockdown/Lockdown.php";
$wgNamespacePermissionLockdown[NS_TOPSCRT]['edit'] = array('FBI_Agents');
$wgNamespacePermissionLockdown[NS_TOPSCRT]['read'] = array('FBI_Agents');
Ckoerner (talk)21:57, 6 February 2014

Yeah, the extension has to be invoked prior to using parameters defined by it. As far as I can see the installation and configuration instructions already say to do so but it might use a more explicit wording. I will now change it a bit. Cheers

[[kgh]] (talk)22:42, 6 February 2014

I have just submitted a patch to gerrit that changes this behaviour, so that you can also set the config variables before loading the extension. I think this may be simpler than changing the docs.

Olenz (talk)07:28, 7 February 2014

Well, this is one option too though the comments on the patchset are not in favour. Predominantly extension specific changes are made after the invokation. This also has the advantage that you quickly find the related settings in the "LocalSettings.php" file which is not the worst of ideas for inexperienced wikiadmins.

[[kgh]] (talk)15:44, 7 February 2014
 
 
 

Not working in Mediawiki 1.21

Hello !

Your extension seems just perfect, but I can not make it work for Mediawiki 1.21. Am I missing something ? And I can not find previous versions of the extension.

I have set everything right but I can not manage to lock down rights (even following your exemples).

Thanks for your help ! 78.220.29.24 14:20, 21 January 2014 (UTC)

78.220.29.2414:20, 21 January 2014

update extension

hi please update this extension to support newer releases of mediawiki please.

86.135.253.1912:01, 12 January 2014

Could you be more specific about this in case it is not working for MW 1.22? It will be nice to get a more verbose description of the issue which helps the programmers tackle it. Besides, adding the update template to the extensions page only means that the documentation should be updated. It is not read as a Call for Updating the extension itself. Cheers

[[kgh]] (talk)13:13, 12 January 2014
 

Locking everything down completely except reading the Main Namespace

I need some help.

I'd like to lockdown the wiki completely and operate as an internal private wiki, but have the main namespace readable by anyone.

That also means locking down access to view file history, special pages, etc..

Is Lockdown the way to do this.. if so how? And are there any security flaws? I know Mediawiki says it's not designed to be a CMS, but if the only thing outside users can do is read the main namespace, then where are the holes?

Thanks,

MarkJurgens (talk)01:53, 17 August 2013

block edit access to user page - except for admins?

block edit access to user page - except for admins?

$wgNamespacePermissionLockdown[user]['edit'] = array('syop');

Is this the correct coding? Using Mediawiki 1.16

It is not working.

Thank you

Igottheconch (talk)23:55, 5 April 2013

"Not absolutely sure but this seems more correct"

$wgNamespacePermissionLockdown[NS_USER]['edit'] = array('syop');

But yours might work also. Cheers,

Mlpearc (powwow)18:04, 28 July 2013

thank you sir, I will try this!

Igottheconch (talk)06:00, 30 July 2013
 
 

Is it working for mw 1.19 ?

Is it working for mw 1.19 ?

62.219.165.22111:29, 28 July 2013

Making lockdown function

I have lockdown working fine using this:

$wgExtraNamespaces[100] = "Hide";
$wgExtraNamespaces[101] = "Hide_Talk";
$wgGroupPermissions['Hide'] = $wgGroupPermissions['user'];
$wgNamespacePermissionLockdown[100]['*'] = array('Hide');
$wgNamespacePermissionLockdown[101]['*'] = array('Hide');

I have to lockdown a BUNCH of namespaces and there are many admins on the site. So, I had the idea to write this function:

function make_lockdown_space($id, $name)
{
    global $wgExtraNamespaces, $wgGroupPermissions, $wgNamespacePermissionLockdown;
    $wgExtraNamespaces[$id] = $name;
    $wgExtraNamespaces[$id+1] = $name."_Talk";
    $wgGroupPermissions[$name] = $wgGroupPermissions['user'];
    $wgNamespacePermissionLockdown[$id]['*'] = array($name);
    $wgNamespacePermissionLockdown[$id+1]['*'] = array($name);
}

With this function, I theoretically only need:

make_lockdown_space(100, "Hide");

With that function, I check all the arrays. All are set. All look good. However, there is no lockdown. Anyone can see the namespaces that are supposedly locked down. Why? I don't see how it is possible that the arrays are altered without a problem, but lockdown fails. Anyone know what is happening?

71.204.230.6622:44, 22 March 2013

Update Credits (for Special:Version)

This is picky and definitely not a priority, but it would be nice to be consistent with other extensions (plus, version ID's would be helpful for dependent developers such as myself).

For consistency, credits could be updated:

$wgExtensionCredits['other'][] = array(
	'path' => __FILE__,
	'name' => 'Lockdown',
	'author' => array( 'Daniel Kinzler', 'Platonides'),
	'url' => 'http://mediawiki.org/wiki/Extension:Lockdown',
	'version'  => "1.0",
	'descriptionmsg' => 'lockdown-desc',
);
jdpond (talk)21:58, 16 March 2013

Works with 1.19.1

Hi all, thought I might just provide a small update. I've tested and implemented the following version details successfully:

MediaWiki 1.19.1 Lockdown-db7023e

Quantos (talk)15:13, 25 January 2013

Lockdown preventing users resetting their password

Hi.

If I have lockdown enabled then users are unable to reset their password or change their password if they have forgotten. They go through the process, but on the final step it says they do not have permission. If have the following defined:

$wgSpecialPageLockdown['ChangePassword'] = array('*');
$wgSpecialPageLockdown['PasswordReset'] = array('user');

But it still does not work. If I disable lockdown then password changes and resets work fine. What required permission am I missing?

Any ideas?

Thanks!

Mitchelln (talk)17:14, 29 November 2012

Problem with mw 1.17

I have used Lockdown with mw 1.15 and 1.16 with no problems. I upgraded a 1.15 to 1.17 with the correct extension version. Editing is configured to logged in users. Logged in as sysop I could not edit at all. Removing lockdown and leaving all other extensions all was fine. I set up a clean mw 1.17. Just added require Lockdown extension and sysop has no ability to see extra special pages. This is similar to comments below. Adding the patch below allows sysop to see the extra pages - 'User rights management'. However until the line $wgSpecialPageLockdown['Userrights'] = array('sysop', 'bureaucrat'); is added it is still impossible to use that page and set rights it says you do not have the right. Following that it now seems to work as expected. New namespaces can be locked to sysop and project can be locked to sysop.

There really does seem to be a fundamental problem with this extension and mw 1.17. This is a lot to work out for a simple install. Some indication should go in the main Lockdown extension page and hopefully an updated download for mw 1.17 produced.

86.163.48.22212:08, 26 August 2011

The problem seems quite simple:

  • MediaWiki starts loading the logged in user
  • While loading it tries to get a list of searchable namespaces and calls the SearchableNamespaces-hook
  • Lockdown kicks in and tries to calculate the searchable namespaces, but needs the groups for that
  • Lockdown asks the user-object for the groups
  • The user-object hasn't finished loading and hasn't loaded the groups yet, so it will only give '*' as the users' groups and caches that.
  • Next time Lockdown - or anything at all! - asks for the groups it will get the cached version: '*'

Changing getEffectiveGroups() to getEffectiveGroups(true) tells MediaWiki to ignore the cache (and even repopulate it) and it will be fixed. However, the first time Lockdown asked for the groups it got a wrong answer so that could cause problems.

The solution is a unfortunately a lot less simple. I think the best way will be to let MediaWiki detect it hasn't loaded the groups yet and do that direct. (Or just change the order so the groups will be loaded before even thinking about searchable namespaces.)

Hope this helps.

Quis23:11, 3 September 2011

Here is what I am getting in my upgrade from Mediawiki 1.16 to 1.17.

Fatal error: Call to undefined method MediaWiki::getAction() in... ...extensions/Lockdown/Lockdown.php on line 130

Which throws back a 500 error. Any suggestions as I really need to upgrade another wiki using the Lockdown extension, but will not upgrade until I am sure Lockdown is working properly. Thanks Hutchy68 17:34, 24 January 2012 (UTC)

Edit--- Yes I am using version for 1.18
Hutchy6817:34, 24 January 2012

I've the same issue. Have changed some php but locking of special pages also does not work...

213.197.11.10211:10, 30 August 2012
 
 
 

Locking down special pages

I was having problem with locking down certain special pages based on user groups with Lockdown on MW 1.17 and 1.16. Here is a solution that doesn't need Lockdown at all, just enter this in your LocalSettings.php:

function SpecialPageBlock(&$list){
global $wgUser;
if (in_array('sysop', $wgUser->getGroups()) == 0){
foreach(array('Uncategorizedimages','Unusedimages','Withoutinterwiki', 'Newimages','Listfiles','MIMEsearch','FileDuplicateSearch','Filepath', 'Booksources','Mostimages','Tags','Disambiguations','BrokenRedirects','Deadendpages', 'DoubleRedirects','Longpages','Ancientpages','Lonelypages','Fewestrevisions','Protectedpages', 'Protectedtitles','Shortpages','Uncategorizedcategories','Uncategorizedpages','Uncategorizedtemplates', 'Unusedcategories','Unusedtemplates','Wantedcategories','Wantedfiles','Wantedpages','Wantedtemplates', 'Allpages','Prefixindex','Categories','Listredirects','Activeusers','Contributions', 'Log','Newpages','Recentchanges','Recentchangeslinked','Listgrouprights','Listusers', 'Popularpages','Statistics','Allmessages','Version','LinkSearch','Random','Randomredirect', 'Mostlinkedcategories','Mostlinkedpages','Mostlinkedtemplates','Mostcategories','Mostrevisions', 'Export','Whatlinkshere'
)as $i){unset($list[$i]);}}
return true;}
$wgHooks['SpecialPage_initList'][]='SpecialPageBlock';

The example above limits access to the pages listed in the array to the 'sysop' group, by removing the pages from the rest of the groups. The best thing in this solution is that the pages in the array won't even show up on the SpecialPages.

For some reason Random and MostLinkedPages couldn't be disabled this way, any ideas why?

TheRebel10:30, 20 November 2011

Thanks! A much better solution. People don't even know what they're missing.

203.118.164.21900:16, 25 November 2011
 

This works perfectly. This should be linked to from restricting access pages. Thanks a bunch.

50.137.193.14903:45, 23 July 2012
 
First page
First page
Previous page
Previous page
Last page
Last page