1 |
diff -Nur smeserver-vacation-1.1.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/uservacations smeserver-vacation-1.1.new/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/uservacations |
2 |
--- smeserver-vacation-1.1.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/uservacations 2016-06-21 09:58:59.709887389 +0200 |
3 |
+++ smeserver-vacation-1.1.new/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/uservacations 2016-06-22 01:01:17.588304177 +0200 |
4 |
@@ -91,4 +91,8 @@ |
5 |
]]> |
6 |
</trans> |
7 |
</entry> |
8 |
+ <entry> |
9 |
+ <base>NO_USERS_IN_GRANTED_GROUPS</base> |
10 |
+ <trans>There are no users in the group(s) that you are granted to manage.</trans> |
11 |
+ </entry> |
12 |
</lexicon> |
13 |
diff -Nur smeserver-vacation-1.1.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/uservacations.pm smeserver-vacation-1.1.new/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/uservacations.pm |
14 |
--- smeserver-vacation-1.1.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/uservacations.pm 2016-06-21 09:58:59.710887388 +0200 |
15 |
+++ smeserver-vacation-1.1.new/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/uservacations.pm 2016-06-22 00:59:15.014349221 +0200 |
16 |
@@ -28,6 +28,8 @@ |
17 |
our $PanelUser = $ENV{'REMOTE_USER'} ||''; |
18 |
$PanelUser = $1 if ($PanelUser =~ /^([a-z][\.\-a-z0-9]*)$/); |
19 |
|
20 |
+our %delegatedVacations; |
21 |
+ |
22 |
sub new { |
23 |
shift; |
24 |
my $self = esmith::FormMagick->new(filename => '/etc/e-smith/web/functions/uservacations'); |
25 |
@@ -52,8 +54,30 @@ |
26 |
my $self = shift; |
27 |
my $q = $self->{cgi}; |
28 |
|
29 |
+#We want to retrieve granted group from DB, and retrieve users of groups |
30 |
+ my $record = $adb->get($PanelUser); |
31 |
+ my $dg=$record->prop('delegatedVacations')||''; |
32 |
+ $dg =~ s/ //g; |
33 |
+ my @g = split(/,/, $dg); |
34 |
+ my @visiblemembers = (); |
35 |
+ |
36 |
+ foreach my $g (@g) { |
37 |
+ my $members = $adb->get_prop("$g",'Members'); |
38 |
+ next unless defined $members; |
39 |
+ $members =~ s/ //g; |
40 |
+ my @members = split(/,/, $members); |
41 |
+ push @visiblemembers , @members ; |
42 |
+ } |
43 |
+ |
44 |
+ foreach my $k ( @visiblemembers ) |
45 |
+ { |
46 |
+ $delegatedVacations{$k}=1; |
47 |
+ } |
48 |
+ |
49 |
+ |
50 |
my @users = $adb->users; |
51 |
return $self->localise("ACCOUNT_USER_NONE") if (@users == 0); |
52 |
+ return $self->localise("NO_USERS_IN_GRANTED_GROUPS") if (@visiblemembers == 0 && $dg ne ''); |
53 |
|
54 |
my $vacation_table = |
55 |
{ |
56 |
@@ -83,6 +107,7 @@ |
57 |
|
58 |
for my $user (@users) |
59 |
{ |
60 |
+ next if %delegatedVacations and not $delegatedVacations{$user->key}; |
61 |
# make it clearer which uses have vacation |
62 |
my $EmailVacation = $user->prop('EmailVacation') || ''; |
63 |
my $EmailVacationFrom = $user->prop('EmailVacationFrom') || ''; |