|
|
|
@ -21,9 +21,11 @@ |
|
|
|
|
|
|
|
|
|
use strict; |
|
|
|
|
use esmith::templates; |
|
|
|
|
use esmith::ConfigDB; |
|
|
|
|
use esmith::AccountsDB; |
|
|
|
|
use File::Path qw(mkpath rmtree); |
|
|
|
|
|
|
|
|
|
my $c = esmith::ConfigDB->open_ro; |
|
|
|
|
my $a = esmith::AccountsDB->open_ro; |
|
|
|
|
|
|
|
|
|
# Remove all the permissions |
|
|
|
@ -48,3 +50,55 @@ foreach my $user (($a->users),$a->get('admin')){ |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
my $ajxp = $c->get('ajaxplorer') || die "Couldn't find ajaxplorer entry in ConfigDB\n"; |
|
|
|
|
my $homedir = $ajxp->prop('HomeDir') || 'none'; |
|
|
|
|
|
|
|
|
|
if ($homedir eq 'enabled'){ |
|
|
|
|
foreach ($a->users){ |
|
|
|
|
my $name = $_->key; |
|
|
|
|
set_user_acl($name); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
elsif ($homedir eq 'users'){ |
|
|
|
|
foreach ($a->users){ |
|
|
|
|
my $name = $_->key; |
|
|
|
|
if (($_key->prop('AjxpHomeDir') || 'disabled') eq 'enabled'){ |
|
|
|
|
set_user_acl($name); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
remove_user_acl($name); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
foreach ($a->users){ |
|
|
|
|
my $name = $_->key; |
|
|
|
|
remove_user_acl($name); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sub set_user_acl{ |
|
|
|
|
my $user = shift; |
|
|
|
|
system('/usr/bin/setfacl', |
|
|
|
|
'-m', |
|
|
|
|
'u:www:x', |
|
|
|
|
"/home/e-smith/files/users/$user"); |
|
|
|
|
system('/usr/bin/setfacl', |
|
|
|
|
'-R' |
|
|
|
|
'-m', |
|
|
|
|
'u:www:rwX,d:u:www:rwX', |
|
|
|
|
"/home/e-smith/files/users/$user/home"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sub remove_user_acl{ |
|
|
|
|
my $user = shift; |
|
|
|
|
system('/usr/bin/setfacl', |
|
|
|
|
'-R', |
|
|
|
|
'-x', |
|
|
|
|
'u:www,d:u:www', |
|
|
|
|
"/home/e-smith/files/users/$user/home"); |
|
|
|
|
system('/usr/bin/setfacl', |
|
|
|
|
'-x', |
|
|
|
|
'u:www', |
|
|
|
|
"/home/e-smith/files/users/$user"); |
|
|
|
|
} |
|
|
|
|