diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php index 4ae7a63ae..6de507f32 100755 --- a/app/Controller/AppController.php +++ b/app/Controller/AppController.php @@ -46,7 +46,7 @@ class AppController extends Controller { public $helpers = array('Utility'); - private $__queryVersion = '10'; + private $__queryVersion = '11'; public $pyMispVersion = '2.4.71'; public $phpmin = '5.6.5'; public $phprec = '7.0.16'; diff --git a/app/Controller/AttributesController.php b/app/Controller/AttributesController.php index f2be6f721..408314152 100644 --- a/app/Controller/AttributesController.php +++ b/app/Controller/AttributesController.php @@ -2787,4 +2787,20 @@ class AttributesController extends AppController { $this->render('ajax/toggle_correlation'); } } + + public function checkAttachments() { + $attributes = $this->Attribute->find('all', array( + 'conditions' => array('Attribute.type' => array('attachment', 'malware-sample')), + 'recursive' => -1) + ); + $counter = 0; + foreach ($attributes as $attribute) { + $path = APP . "files" . DS . $attribute['Attribute']['event_id'] . DS; + $file = $attribute['Attribute']['id']; + if (!file_exists($path . $file)) { + $counter++; + } + } + return new CakeResponse(array('body'=>$counter, 'status'=>200)); + } } diff --git a/app/Controller/Component/ACLComponent.php b/app/Controller/Component/ACLComponent.php index 7eaa5fc58..768d504e8 100644 --- a/app/Controller/Component/ACLComponent.php +++ b/app/Controller/Component/ACLComponent.php @@ -35,6 +35,7 @@ class ACLComponent extends Component { 'attributeReplace' => array('perm_add'), 'attributeStatistics' => array('*'), 'bro' => array('*'), + 'checkAttachments' => array(), 'checkComposites' => array('perm_admin'), 'checkOrphanedAttributes' => array(), 'delete' => array('perm_add'), @@ -368,7 +369,6 @@ class ACLComponent extends Component { 'attributehistogram' => array('*'), 'change_pw' => array('*'), 'checkAndCorrectPgps' => array(), - 'checkAttachments' => array(), 'dashboard' => array('*'), 'delete' => array('perm_admin'), 'downloadTerms' => array('*'), diff --git a/app/Controller/UsersController.php b/app/Controller/UsersController.php index 9363cd7aa..00448f4be 100644 --- a/app/Controller/UsersController.php +++ b/app/Controller/UsersController.php @@ -1451,21 +1451,4 @@ class UsersController extends AppController { $this->set('notifications', $notifications); $this->set('events', $events); } - - public function checkAttachments() { - $this->loadModel('Attribute'); - $attributes = $this->Attribute->find('all', array( - 'conditions' => array('Attribute.type' => array('attachment', 'malware-sample')), - 'recursive' => -1) - ); - $counter = 0; - foreach ($attributes as $attribute) { - $path = APP . "files" . DS . $attribute['Attribute']['event_id'] . DS; - $file = $attribute['Attribute']['id']; - if (!file_exists($path . $file)) { - $counter++; - } - } - return new CakeResponse(array('body'=>$counter, 'status'=>200)); - } } diff --git a/app/webroot/js/misp.js b/app/webroot/js/misp.js index c84ad4db8..f2ad15977 100644 --- a/app/webroot/js/misp.js +++ b/app/webroot/js/misp.js @@ -2786,7 +2786,7 @@ function checkAttachments() { }, type:"get", cache: false, - url: "/users/checkAttachments/", + url: "/attributes/checkAttachments/", }); }