Reputation: 61
I need help with two things:
I create article in Mediawiki with f.ex. financial data and I would like to block it for all users except one user or user group called "financial". Is there a way to make it simple, maybe while creating this article?
I would like to block all special pages to users, how to do it? I blocked editing, discussing etc and I need to block all special pages to users.
Upvotes: 0
Views: 1501
Reputation: 8520
First: If you really need to set per article permission, then you are using the wrong tool. Mediawiki is designed to be open and highly collaborative, and working around that will A) require hacks and B) never be entirely secure. (See MediaWiki: Security issues with authorization extensions. In brief: There will be ways for users to access the content of restricted pages.)
Now, if you still want to try and restrict access to some pages, there are a few extensions to choose from. Among thoose Extension:Lockdown will allow you to set per namespace permissions, and special page restrictions. You would then have to create one namespace per access setting, and put your financial data in a restricted namespace, e.g. Restricted:Financial
Your LocalSettings.php would look something like this (just an example!):
#add a new user group
$wgGroupPermissions['trusted-user'] = $wgGroupPermissions['user'];
#add namespace
define('NS_RESTRICTED', 550);
define('NS_RESTRICTED_TALK', 551);
$wgExtraNamespaces[NS_RESTRICTED] = 'Restricted';
$wgExtraNamespaces[NS_RESTRICTED_TALK] = 'Restricted_talk';
#lockdown namespace
$wgNamespacePermissionLockdown[NS_RESTRICTED]['read'] = array('trusted-user');
$wgNamespacePermissionLockdown[NS_RESTRICTED_TALK]['read'] = array('trusted-user');
#disallow inclusion
$wgNonincludableNamespaces[] = NS_RESTRICTED;
$wgNonincludableNamespaces[] = NS_RESTRICTED_TALK;
Note that we added the namespace to $wgNonincludableNamespaces
, to prevent users from viewing the content through inclusion (by simply writing {{Restricted:Financial}}
on some page).
Then we proceed to lock down all the special pages:
$wgSpecialPageLockdown['Statistics'] = array('sysop');
$wgSpecialPageLockdown['Version'] = array('sysop');
$wgSpecialPageLockdown['Export'] = array('sysop');
...
This will be a long list, and it will change a bit from version to version of MediaWiki, as special pages come and go.
*Before you start heading down this path, please read the warnings at https://www.mediawiki.org/wiki/Manual:Preventing_access#Restrict_viewing_of_certain_specific_pages , and think again about if MediaWiki is really the right tool for your needs*
Upvotes: 4