X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2Fbin%2Ffreeside-queued;h=398b03d1293aa9341d81a2e3fd00f11ef181b68c;hb=cc4b5ec5fdbf35c919cf7903b67cf6a1309a229d;hp=70d85348384e8df22d22998830bcc70204509593;hpb=7caec8842cb8959515204b45aef368f243e87e33;p=freeside.git diff --git a/FS/bin/freeside-queued b/FS/bin/freeside-queued index 70d853483..398b03d12 100644 --- a/FS/bin/freeside-queued +++ b/FS/bin/freeside-queued @@ -196,7 +196,7 @@ while (1) { dbh->{'private_profile'} = {} if UNIVERSAL::can(dbh, 'sprintProfile'); #auto-use classes... - if ( $ljob->job =~ /(FS::(part_export|cust_main|cust_pkg|Cron)::\w+)::/ + if ( $ljob->job =~ /(FS::(part_export|cust_main|cust_pkg|part_pkg|Cron)::\w+)::/ || $ljob->job =~ /(FS::\w+)::/ ) { @@ -218,8 +218,13 @@ while (1) { # don't put @args in the log, may expose passwords $log->info('starting job ('.$ljob->job.')'); warn 'running "&'. $ljob->job. '('. join(', ', @args). ")\n" if $DEBUG; + # switch user only if a job user is available + my $oldCurrentUser = $FS::CurrentUser::CurrentUser; + my $jobuser = $ljob->access_user; + local $FS::CurrentUser::CurrentUser = $jobuser if $jobuser; local $FS::UID::AutoCommit = 0; # so that we can clean up failures eval $eval; #throw away return value? suppose so + $FS::CurrentUser::CurrentUser = $oldCurrentUser if $jobuser; if ( $@ ) { dbh->rollback; my %hash = $ljob->hash;