-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
#629 (comment) https://sourceforge.net/p/webadmin/discussion/600155/thread/20ec35f980/?limit=25#aad9
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/perl | ||
|
||
# | ||
# Authentic Theme (https://github.com/authentic-theme/authentic-theme) | ||
# Copyright Ilia Rostovtsev <[email protected]> | ||
# Licensed under MIT (https://github.com/authentic-theme/authentic-theme/blob/master/LICENSE) | ||
# | ||
use strict; | ||
|
||
use lib ("$ENV{'THEME_ROOT'}/lib"); | ||
|
||
our (%access, @remote_user_info, %in, %text, $path); | ||
|
||
do("$ENV{'THEME_ROOT'}/extensions/file-manager/file-manager-lib.pl"); | ||
|
||
my %errors; | ||
my $tdirname = '.Trash'; | ||
my $trashall = $in{'trash_all'}; | ||
|
||
# Delete all trashes if allowed | ||
if ($trashall && | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
iliajie
Author
Collaborator
|
||
$access{'work_as_root'} && | ||
!$access{'work_as_user'}) | ||
{ | ||
&foreign_require("useradmin"); | ||
my %uaconfig = %useradmin::config; | ||
my %uaaccess = %useradmin::access; | ||
my @uaallulist = &useradmin::list_users(); | ||
my @uaulist = &useradmin::list_allowed_users(\%uaaccess, \@uaallulist); | ||
my @uahomeulist = | ||
grep {$_->{'home'} =~ /^\Q$uaconfig{'home_base'}\E/ && $_->{'uid'} >= 1000 && $_->{'shell'} !~ /\/dev\/null/} @uaulist; | ||
This comment has been minimized.
Sorry, something went wrong.
jcameron
Collaborator
|
||
foreach my $uhome (@uahomeulist) { | ||
my $tdir = "$uhome->{'home'}/$tdirname"; | ||
&unlink_file($tdir) if (-w $tdir); | ||
} | ||
} | ||
|
||
# Delete for the current user | ||
elsif (-w $remote_user_info[7]) { | ||
my $tdir = "$remote_user_info[7]/$tdirname"; | ||
&unlink_file($tdir) if (-w $tdir); | ||
} | ||
|
||
redirect_local( | ||
'list.cgi?path=' . urlize($path) . '&module=' . $in{'module'} . '&error=' . get_errors(\%errors) . extra_query()); |
Are you sure you want this feature to delete trash for all users? It seems kind of dangerous