mirror of https://github.com/MISP/MISP
Org admins should be able to delete / edit their own server links
parent
fb7f084e70
commit
467408d9f7
|
@ -135,7 +135,7 @@ class ServersController extends AppController {
|
||||||
throw new NotFoundException(__('Invalid server'));
|
throw new NotFoundException(__('Invalid server'));
|
||||||
}
|
}
|
||||||
$s = $this->Server->read(null, $id);
|
$s = $this->Server->read(null, $id);
|
||||||
if (!$this->_isSiteAdmin() && !($s['Server']['org'] == $this->Auth->user('org') && $this->_isSiteAdmin())) $this->redirect(array('controller' => 'servers', 'action' => 'index'));
|
if (!$this->_isSiteAdmin() && !($s['Server']['org'] == $this->Auth->user('org') && $this->_isAdmin())) $this->redirect(array('controller' => 'servers', 'action' => 'index'));
|
||||||
if ($this->Server->delete()) {
|
if ($this->Server->delete()) {
|
||||||
$this->Session->setFlash(__('Server deleted'));
|
$this->Session->setFlash(__('Server deleted'));
|
||||||
$this->redirect(array('action' => 'index'));
|
$this->redirect(array('action' => 'index'));
|
||||||
|
@ -162,7 +162,7 @@ class ServersController extends AppController {
|
||||||
throw new NotFoundException(__('Invalid server'));
|
throw new NotFoundException(__('Invalid server'));
|
||||||
}
|
}
|
||||||
$s = $this->Server->read(null, $id);
|
$s = $this->Server->read(null, $id);
|
||||||
if (!$this->_isSiteAdmin() && !($s['Server']['org'] == $this->Auth->user('org') && $this->_isSiteAdmin())) $this->redirect(array('controller' => 'servers', 'action' => 'index'));
|
if (!$this->_isSiteAdmin() && !($s['Server']['org'] == $this->Auth->user('org') && $this->_isAdmin())) $this->redirect(array('controller' => 'servers', 'action' => 'index'));
|
||||||
$this->Server->id = $id;
|
$this->Server->id = $id;
|
||||||
if (!$this->Server->exists()) {
|
if (!$this->Server->exists()) {
|
||||||
throw new NotFoundException(__('Invalid server'));
|
throw new NotFoundException(__('Invalid server'));
|
||||||
|
@ -231,7 +231,7 @@ class ServersController extends AppController {
|
||||||
throw new NotFoundException(__('Invalid server'));
|
throw new NotFoundException(__('Invalid server'));
|
||||||
}
|
}
|
||||||
$s = $this->Server->read(null, $id);
|
$s = $this->Server->read(null, $id);
|
||||||
if (!$this->_isSiteAdmin() && !($s['Server']['org'] == $this->Auth->user('org') && $this->_isSiteAdmin())) $this->redirect(array('controller' => 'servers', 'action' => 'index'));
|
if (!$this->_isSiteAdmin() && !($s['Server']['org'] == $this->Auth->user('org') && $this->_isAdmin())) $this->redirect(array('controller' => 'servers', 'action' => 'index'));
|
||||||
if (!Configure::read('MISP.background_jobs')) {
|
if (!Configure::read('MISP.background_jobs')) {
|
||||||
$server = $this->Server->read(null, $id);
|
$server = $this->Server->read(null, $id);
|
||||||
App::uses('SyncTool', 'Tools');
|
App::uses('SyncTool', 'Tools');
|
||||||
|
|
Loading…
Reference in New Issue