mirror of
https://github.com/webmin/webmin.git
synced 2026-05-04 14:20:31 +01:00
Fix save and run cron job when changing user
http://www.virtualmin.com/node/18806
This commit is contained in:
@@ -338,7 +338,8 @@ else {
|
||||
$_[0]->{'line'} = scalar(@$lref);
|
||||
push(@$lref, &cron_job_line($_[0]));
|
||||
&flush_file_lines();
|
||||
system("chown $_[0]->{'user'} $cron_temp_file");
|
||||
&set_ownership_permissions($_[0]->{'user'}, undef, undef,
|
||||
$cron_temp_file);
|
||||
©_crontab($_[0]->{'user'});
|
||||
$_[0]->{'file'} = "$config{'cron_dir'}/$_[0]->{'user'}";
|
||||
$_[0]->{'index'} = scalar(@cron_jobs_cache);
|
||||
|
||||
@@ -75,6 +75,7 @@ save_eallow=The user '$1' is not allowed to access cron
|
||||
save_ecannot=You are not allowed to create or edit cron jobs for '$1'
|
||||
save_enone=You did not choose any $1 to execute
|
||||
save_ecannot2=You are not allowed to create cron jobs
|
||||
save_eidx=Cron job was successfully saved, but cannot be run as it was not found!
|
||||
|
||||
allow_title=Control Cron Access
|
||||
allow_desc=This form allows you to control which users can create and run cron jobs.
|
||||
|
||||
@@ -79,6 +79,17 @@ if (!$in{'new'}) {
|
||||
else {
|
||||
&delete_cron_job($oldjob);
|
||||
&create_cron_job($job);
|
||||
|
||||
# Find new index, which will change due to user move
|
||||
undef(@cron_jobs_cache);
|
||||
$in{'idx'} = undef;
|
||||
foreach $newjob (&list_cron_jobs()) {
|
||||
if ($newjob->{'user'} eq $job->{'user'} &&
|
||||
$newjob->{'active'} eq $job->{'active'} &&
|
||||
$newjob->{'command'} eq $job->{'command'}) {
|
||||
$in{'idx'} = $newjob->{'index'};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -96,6 +107,7 @@ else {
|
||||
|
||||
if ($in{'saverun'}) {
|
||||
# Redirect to execute form
|
||||
defined($in{'idx'}) || &error($text{'save_eidx'});
|
||||
&redirect("exec_cron.cgi?idx=$in{'idx'}");
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user