added possibility to approve users to ACL policies in installer

This commit is contained in:
Anika Henke 2013-11-09 19:51:29 +00:00
parent b4304655d0
commit 74850f2906
2 changed files with 10 additions and 3 deletions

View File

@ -315,6 +315,7 @@ $lang['i_policy'] = 'Initial ACL policy';
$lang['i_pol0'] = 'Open Wiki (read, write, upload for everyone)';
$lang['i_pol1'] = 'Public Wiki (read for everyone, write and upload for registered users)';
$lang['i_pol2'] = 'Closed Wiki (read, write, upload for registered users only)';
$lang['i_policyapprove'] = 'Registered users need to be approved before allowing access (to a Public or Closed Wiki)';
$lang['i_retry'] = 'Retry';
$lang['i_license'] = 'Please choose the license you want to put your content under:';
$lang['i_license_none'] = 'Do not show any license information';

View File

@ -207,6 +207,10 @@ function print_form($d){
<option value="2" <?php echo ($d['policy'] == 2)?'selected="selected"':'' ?>><?php echo $lang['i_pol2']?></option>
</select>
<label for="approve">
<input type="checkbox" name="d[approve]" id="approve" <?php echo(($d['approve'] ? ' checked="checked"' : ''));?> />
<?php echo $lang['i_policyapprove']?>
</label>
</fieldset>
</fieldset>
@ -270,6 +274,7 @@ function check_data(&$d){
'password' => '',
'confirm' => '',
'policy' => '0',
'approve' => '0',
'license' => 'cc-by-sa'
);
global $lang;
@ -332,6 +337,7 @@ function store_data($d){
global $LC;
$ok = true;
$d['policy'] = (int) $d['policy'];
$usergroup = $d['approve'] ? 'member' : 'user';
// create local.php
$now = gmdate('r');
@ -360,7 +366,7 @@ EOT;
// create users.auth.php
// --- user:SMD5password:Real Name:email:groups,comma,seperated
$output = join(":",array($d['superuser'], $pass, $d['fullname'], $d['email'], 'admin,user'));
$output = join(":",array($d['superuser'], $pass, $d['fullname'], $d['email'], 'admin,'.$usergroup));
$output = @file_get_contents(DOKU_CONF.'users.auth.php.dist')."\n$output\n";
$ok = $ok && fileWrite(DOKU_LOCAL.'users.auth.php', $output);
@ -378,10 +384,10 @@ EOT;
EOT;
if($d['policy'] == 2){
$output .= "* @ALL 0\n";
$output .= "* @user 8\n";
$output .= "* @".$usergroup." 8\n";
}elseif($d['policy'] == 1){
$output .= "* @ALL 1\n";
$output .= "* @user 8\n";
$output .= "* @".$usergroup." 8\n";
}else{
$output .= "* @ALL 8\n";
}