Topic on Extension talk:Lockdown

Still not working in MW 1.27 for regular users

12
Summary by Kghbln

If you are working with MediaWiki 1.27.x make sure you are using REL1_27 of this extension. Versions of Lockdown which are meant to work with MW <= 1.26 and >= 1.28 will not work with 1.27

Christharp (talkcontribs)

Cloned it, downloaded it, etc., but still not working. AS far as I can tell I have the newest version. Any help would be great @Kghbln

Kghbln (talkcontribs)

Works for me. Are you sure that you are on REL1_27 of this extension? Indeed, master will not work.

Christharp (talkcontribs)

Tried and tried. Nothing seems to work. Tried downloading, tried git clone, etc., tried the REL1_27 and the master. It never works. So not sure what is going on if it's working for other people.

Kghbln (talkcontribs)
Stefahn (talkcontribs)

I tried master too at first (which didn't work). Then I used the Extension Distributor, which gave me the working version :)

176.195.65.39 (talkcontribs)

I tried to use Lockdown within private wiki (i.e. $wgGroupPermissions['*']['read'] = false).

It breaks WikiEditor preview feature. I found that even being sysop I don't have read right for API. Digging further showed that 'user' (and 'autoconfirmed') implicit groups were not added to my user (thus leaving only explicit ones and '*'), while basic permissions such as read/write are in 'user' group. I am not that good with MW code to figure out the reason, but it appears that Lockdown calls User::GetRights() too early which results in memoizing only '*' group in mEffectiveGroups.

The version cloned from the git master would not allow me read rights at all, so I cannot access my wiki even as sysop.

Kghbln (talkcontribs)

I just tested with WikiEditor and I cannot confirm your observation. I think the issue is that you did not upgrade your version of Lockdown in the first case and later on you just upgraded to master which will fail too as expected. Move in the version for MediaWiki 1.27 i. e. REL1_27 since this is actually the only working version for MW 1.27.x.

79.104.211.130 (talkcontribs)

You are right, I reinstalled REL1_27 anew and the problem resolved.

Kghbln (talkcontribs)

Great, thanks for confirming.

79.104.211.130 (talkcontribs)

I should apologize because the only reason my problem appeared resolved after I installed REL1_27 was that I had Lockdown extension commented out in LocalSettings.

So, today I tested it again and preview did not work. Namely, request to /w/api.php with this POST data:

action:parse

format:json

formatversion:2

title:<Title here>

text:<Content here>

pst:

prop:text|modules|jsconfigvars

preview:true

disableeditsection:true

uselang:ru

fails with the following response: {"error":{"code":"readapidenied","info":"You need read permission to use this module","docref":"See http://doc.ifcg.ru/w/api.php for API usage"}}

Non-default part of my LocalSettings follows:

$wgGroupPermissions['*']['createaccount'] = false;

$wgGroupPermissions['*']['edit'] = false;

$wgGroupPermissions['*']['read'] = false;

# Enabled Extensions. Most extensions are enabled by including the base extension file here

# but check specific extension documentation for more details

# The following extensions were automatically enabled:

wfLoadExtension( "Cite" );

wfLoadExtension( "Interwiki" );

wfLoadExtension( "SyntaxHighlight_GeSHi" );

wfLoadExtension( "WikiEditor" );

wfLoadExtension( "ParserFunctions" );

require_once( "$IP/extensions/Lockdown/Lockdown.php" );

require_once( "$IP/extensions/Scribunto/Scribunto.php" );

$wgScribuntoDefaultEngine = 'luasandbox';

# File upload

$wgFileExtensions[] = 'docx';

$wgFileExtensions[] = 'doc';

$wgFileExtensions[] = 'xlsx';

$wgFileExtensions[] = 'xls';

$wgFileExtensions[] = 'pptx';

$wgFileExtensions[] = 'ppt';

$wgFileExtensions[] = 'pdf';

$wgFileExtensions[] = 'mpp';

$wgFileExtensions[] = 'odt';

$wgFileExtensions[] = 'ods';

$wgFileExtensions[] = 'odg';

$wgFileExtensions[] = 'odp';

$wgFileExtensions[] = 'djvu';

$wgFileExtensions[] = 'svg';

# Hide Powered icon

$wgFooterIcons = ['copyright' => ['copyright' => false]];

# Hide About/Privacy etc footer links

$wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'hookFooterLinks';

function hookFooterLinks( $sk, &$tpl ) {

$tpl->data['footerlinks']['places'] = array();

return true;

}

## WikiEditor

# Enables use of WikiEditor by default but still allows users to disable it in preferences

$wgDefaultUserOptions['usebetatoolbar'] = 1;

# Enables link and table wizards by default but still allows users to disable them in preferences

$wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;

# Displays the Preview and Changes tabs

$wgDefaultUserOptions['wikieditor-preview'] = 1;

# Displays the Publish and Cancel buttons on the top right side

$wgDefaultUserOptions['wikieditor-publish'] = 1;

define("NS_RD", 3000);

define("NS_RD_TALK", 3001);

define("NS_TO", 3002);

define("NS_TO_TALK", 3003);

define("NS_CERT", 3004);

define("NS_CERT_TALK", 3005);

$wgExtraNamespaces[NS_RD] = "РД";

$wgExtraNamespaces[NS_RD_TALK] = "РД_Обсуждение";

$wgExtraNamespaces[NS_TO] = "ТО";

$wgExtraNamespaces[NS_TO_TALK] = "ТО_Обсуждение";

$wgExtraNamespaces[NS_CERT] = "С";

$wgExtraNamespaces[NS_CERT_TALK] = "С_Обсуждение";

$wgGroupPermissions['rd']['edit'] = true;

$wgGroupPermissions['to']['edit'] = true;

$wgGroupPermissions['cert']['edit'] = true;

$wgNamespacePermissionLockdown[NS_RD]['edit'] = array('sysop', 'rd');

$wgNamespacePermissionLockdown[NS_TO]['edit'] = array('sysop', 'to');

$wgNamespacePermissionLockdown[NS_CERT]['edit'] = array('sysop', 'cert');

Hope this will help.

Rrosenfeld (talkcontribs)

Same problem here.

I use REL-1.27 (0d8aa13) with a private wiki (access only for logged in users).

On API access I get the message "readapidenied".

The problem is, that checkExecutePermissions() in ApiMain.php has $user->isAllowed( 'read' ) unset, which results in the above error.

But I have no idea, what I have to do to get this set here.

Kghbln (talkcontribs)