From 5a10c7d865dfe63de4177aa59d05995f65c8fe85 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 26 Sep 2013 19:54:39 +0200 Subject: [PATCH] Remove rights.ser templates, now permissions are managed in role.ser --- createlinks | 1 - .../e-smith/events/actions/ajaxplorer-user-rights | 6 --- .../plugins/auth.serial/__user__/rights.ser/10All | 58 ---------------------- 3 files changed, 65 deletions(-) delete mode 100644 root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/__user__/rights.ser/10All diff --git a/createlinks b/createlinks index 25ece5b..3167bc6 100644 --- a/createlinks +++ b/createlinks @@ -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"); diff --git a/root/etc/e-smith/events/actions/ajaxplorer-user-rights b/root/etc/e-smith/events/actions/ajaxplorer-user-rights index 1ab3d99..eeb98ff 100644 --- a/root/etc/e-smith/events/actions/ajaxplorer-user-rights +++ b/root/etc/e-smith/events/actions/ajaxplorer-user-rights @@ -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"; diff --git a/root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/__user__/rights.ser/10All b/root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/__user__/rights.ser/10All deleted file mode 100644 index 1937c6c..0000000 --- a/root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/__user__/rights.ser/10All +++ /dev/null @@ -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; - -} -