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

View File

@ -59,8 +59,9 @@ public function add() {
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'));
return;
}