Remove rights.ser templates, now permissions are managed in role.ser

tags/0.1.8
Daniel Berteaud 11 years ago
parent 65a287bdb4
commit 5a10c7d865
  1. 1
      createlinks
  2. 6
      root/etc/e-smith/events/actions/ajaxplorer-user-rights
  3. 58
      root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/auth.serial/__user__/rights.ser/10All

@ -32,6 +32,5 @@ event_link("ajaxplorer-user-rights", "group-delete", "85");
event_link("ajaxplorer-user-rights", "user-modify-admin", "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/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/auth.serial/users.ser/template-begin");
safe_touch("root/etc/e-smith/templates/var/lib/ajaxplorer/plugins/conf.serial/plugins_configs.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); mkpath('/var/lib/ajaxplorer/plugins/auth.serial/' . $name);
chmod 0770, "/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"; 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"){ if (-s "/var/lib/ajaxplorer/plugins/auth.serial/$name/role.ser"){
open RROLE, "/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…
Cancel
Save