Remove rights.ser templates, now permissions are managed in role.ser
This commit is contained in:
parent
65a287bdb4
commit
5a10c7d865
|
@ -32,6 +32,5 @@ event_link("ajaxplorer-user-rights", "group-delete", "85");
|
|||
event_link("ajaxplorer-user-rights", "user-modify-admin", "85");
|
||||
|
||||
safe_touch("root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/roles.ser/template-begin");
|
||||
safe_touch("root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/__user__/rights.ser/template-begin");
|
||||
safe_touch("root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/users.ser/template-begin");
|
||||
safe_touch("root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/conf.serial/plugins_configs.ser/template-begin");
|
||||
|
|
|
@ -44,12 +44,6 @@ foreach my $user (($a->users),$a->get('admin')){
|
|||
mkpath('/var/lib/ajaxplorer/plugins/auth.serial/' . $name);
|
||||
chmod 0770, "/var/lib/ajaxplorer/plugins/auth.serial/$name";
|
||||
chown '0', '102', "/var/lib/ajaxplorer/plugins/auth.serial/$name";
|
||||
processTemplate(
|
||||
{
|
||||
TEMPLATE_PATH => "/var/lib/ajaxplorer/plugins/auth.serial/__user__/rights.ser",
|
||||
MORE_DATA => {KEY=>$name},
|
||||
OUTPUT_FILENAME => "/var/lib/ajaxplorer/plugins/auth.serial/$name/rights.ser",
|
||||
});
|
||||
|
||||
if (-s "/var/lib/ajaxplorer/plugins/auth.serial/$name/role.ser"){
|
||||
open RROLE, "/var/lib/ajaxplorer/plugins/auth.serial/$name/role.ser";
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
{
|
||||
|
||||
use PHP::Serialization qw(serialize);
|
||||
use esmith::AccountsDB;
|
||||
|
||||
my $a = esmith::AccountsDB->open_ro || die "Error opening accounts db\n";
|
||||
my @s = $a->get_all_by_prop( type => 'share' );
|
||||
my $data;
|
||||
my $id = $KEY;
|
||||
|
||||
foreach my $share (@s){
|
||||
my $sharename = $share->key;
|
||||
my $access = $share->prop('Ajaxplorer') || 'disabled';
|
||||
next unless ($access eq 'enabled');
|
||||
my @readgroups = split(/[;,]/, $share->prop('ReadGroups') || '');
|
||||
my @writegroups = split(/[;,]/, $share->prop('WriteGroups') || '');
|
||||
my @readusers = split(/[;,]/, $share->prop('ReadUsers') || '');
|
||||
my @writeusers = split(/[;,]/, $share->prop('WriteUsers') || '');
|
||||
|
||||
|
||||
foreach (@readgroups){
|
||||
$data->{$sharename} = 'r' if ( $a->is_user_in_group($id,$_) );
|
||||
}
|
||||
foreach (@writegroups){
|
||||
$data->{$sharename} = 'rw' if ( $a->is_user_in_group($id,$_) );
|
||||
}
|
||||
foreach (@readusers){
|
||||
$data->{$sharename} = 'r' if ( $_ eq $id );
|
||||
}
|
||||
foreach (@writeusers){
|
||||
$data->{$sharename} = 'rw' if ( $_ eq $id );
|
||||
}
|
||||
}
|
||||
|
||||
$data->{'ajxp.admin'} = ($id eq 'admin') ? 1:0;
|
||||
|
||||
$data->{'ajxp_shared'} = 'rw'
|
||||
if (($ajaxplorer{'PublicShares'} || 'enabled') eq 'enabled');
|
||||
|
||||
my $homedir = $ajaxplorer{'HomeDir'} || 'none';
|
||||
|
||||
if ($homedir eq 'enabled'){
|
||||
$data->{'home'} = 'r';
|
||||
}
|
||||
elsif ($homedir eq 'users'){
|
||||
my $acc = $a->get($id);
|
||||
my $ajxphomedir = $acc->prop('AjxpHomeDir') || 'disabled';
|
||||
$data->{'home'} = 'r' if ($ajxphomedir eq 'enabled');
|
||||
}
|
||||
|
||||
# Hugly hack to convert int -> bool
|
||||
my $string = serialize($data);
|
||||
$string =~ s/i:/b:/;
|
||||
|
||||
$OUT = $string;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue