Fixed some background worker issues

- scheduled pulls would fail because of invalid user object passed
- invalid permissions checks / org checks would cause the RPZ export to fail when using background workers
pull/796/head
iglocska 2015-12-26 01:35:34 +01:00
parent a265553f71
commit ba95648fa5
2 changed files with 3 additions and 3 deletions

View File

@ -123,10 +123,10 @@ class EventShell extends AppShell
$values = $this->Attribute->rpz($user);
$this->Job->saveField('progress', 80);
$dir = new Folder(APP . DS . '/tmp/cached_exports/' . $extra);
if ($isSiteAdmin) {
if ($user['Role']['perm_site_admin']) {
$file = new File($dir->pwd() . DS . 'misp.rpz.ADMIN.txt');
} else {
$file = new File($dir->pwd() . DS . 'misp.rpz.' . $org . '.txt');
$file = new File($dir->pwd() . DS . 'misp.rpz.' . $user['Organisation']['name'] . '.txt');
}
App::uses('RPZExport', 'Export');
$rpzExport = new RPZExport();

View File

@ -105,7 +105,7 @@ class ServerShell extends AppShell
App::uses('SyncTool', 'Tools');
$syncTool = new SyncTool();
$result = $this->Server->pull($user['User'], $server['Server']['id'], 'full', $server, $jobId);
$result = $this->Server->pull($user, $server['Server']['id'], 'full', $server, $jobId);
$this->Job->save(array(
'id' => $jobId,
'message' => 'Job done.',