+<% if @mediawiki[:private_accounts] -%>
+# Prevent new user registrations except by existing users
+$wgGroupPermissions['*']['createaccount'] = false;
+$wgGroupPermissions['user']['createaccount'] = true;
+<% end -%>
+<% if @mediawiki[:private_site] -%>
+
+# Disable reading by anonymous users
+$wgGroupPermissions['*']['read'] = false;
+
+# Allow anonymous users to access the login page
+$wgWhitelistRead = array ("Special:Userlogin");
+
+# Prevent new user registrations except by sysops
+$wgGroupPermissions['*']['createaccount'] = false;
+
+# Restrict access to the upload directory
+$wgUploadPath = "$wgScriptPath/img_auth.php";
+<% end -%>
+
+# Allow Subpages on Main Namespace