Merge branch 'fix_2279_delete_camera_through_api' into storageareas

This commit is contained in:
Isaac Connor 2018-10-29 12:52:27 -04:00
commit bc4fada34c
2 changed files with 7 additions and 4 deletions

View File

@ -207,7 +207,9 @@ class MonitorsController extends AppController {
if ( !$this->Monitor->exists() ) { if ( !$this->Monitor->exists() ) {
throw new NotFoundException(__('Invalid monitor')); throw new NotFoundException(__('Invalid monitor'));
} }
if ( $this->Session->Read('systemPermission') != 'Edit' ) { global $user;
$canEdit = (!$user) || ($user['System'] == 'Edit');
if ( !$canEdit ) {
throw new UnauthorizedException(__('Insufficient privileges')); throw new UnauthorizedException(__('Insufficient privileges'));
return; return;
} }

View File

@ -59,8 +59,9 @@ public function add() {
if ($this->request->is('post')) { if ($this->request->is('post')) {
if ($this->Session->Read('systemPermission') != 'Edit') global $user;
{ $canEdit = (!$user) || ($user['System'] == 'Edit');
if ( !$canEdit ) {
throw new UnauthorizedException(__('Insufficient privileges')); throw new UnauthorizedException(__('Insufficient privileges'));
return; return;
} }