-
Notifications
You must be signed in to change notification settings - Fork 0
/
LockdownSetupPermissions.php
51 lines (41 loc) · 1.77 KB
/
LockdownSetupPermissions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
if (!defined('MEDIAWIKI')) die();
/*
* Set up the namespaces access for lockdown Defaults
* lockdown wikis generally require user registration to access more than the first page
* Additionally, namespaces are widely used to protect information that is limited to users
* who belong to the groups with the same name as the namespaces.
* this sets everything up accordingly.
*/
if ( $lockdownApprovedUsersOnlyWiki ) {
# Implicit group for all visitors
$wgGroupPermissions['*']['createaccount'] = true;
foreach ($lockdownDefaultPrivileges as $priv) $wgGroupPermissions['*'][$priv] = false;
# Implicit group for all logged-in accounts
$wgGroupPermissions['user']['createaccount'] = true;
foreach ($lockdownDefaultPrivileges as $priv) $wgGroupPermissions['user'][$priv] = false;
# Approved accounts
foreach ($lockdownDefaultPrivileges as $priv) $wgGroupPermissions['approved'][$priv] = true;
# Sysops
foreach ($lockdownDefaultPrivileges as $priv) $wgGroupPermissions['sysop'][$priv] = true;
}
$curNS = $lockdownStartNS;
foreach($lockdownNameSpaces as $thisNS){
if ($curNS == $smwgNamespaceIndex) $curNS += 10;
$ucNS = strtoupper($thisNS);
# define numeric namespaces
define("NS_$ucNS",$curNS);
define("NS_".$ucNS."_talk", $curNS+1);
# define as extra namespaces
$wgExtraNamespaces[$curNS] = $ucNS;
$wgExtraNamespaces[$curNS+1] = $ucNS."_talk";
# Indicate these namespaces are actually eligible to have content
$wgContentNamespaces[] = $curNS;
$wgContentNamespaces[] = $curNS+1;
# Make Namespaces unincludable as templates
$wgNonincludableNamespaces[] = $curNS;
$wgNonincludableNamespaces[] = $curNS+1;
# Add new group accounts corresponding to NS Name
$wgGroupPermissions[strtolower($thisNS)]['read'] = false;
$curNS += 2;
}