parent
65a287bdb4
commit
5a10c7d865
3 changed files with 0 additions and 65 deletions
@ -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