mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
raise unauthorized exception when authenticated user do not have proper rights
This commit is contained in:
@@ -100,10 +100,18 @@ class MoveCollection extends RecordHelper
|
|||||||
$appbox = \appbox::get_instance();
|
$appbox = \appbox::get_instance();
|
||||||
$user = $this->getCore()->getAuthenticatedUser();
|
$user = $this->getCore()->getAuthenticatedUser();
|
||||||
|
|
||||||
|
$baseId = $request->get('base_id');
|
||||||
|
|
||||||
$base_dest =
|
$base_dest =
|
||||||
$user->ACL()->has_right_on_base($request->get('base_id'), 'canaddrecord') ?
|
$user->ACL()->has_right_on_base($baseId, 'canaddrecord') ?
|
||||||
$request->get('base_id') : false;
|
$request->get('base_id') : false;
|
||||||
|
|
||||||
|
if(!$user->ACL()->has_right_on_base($baseId, 'canaddrecord'))
|
||||||
|
{
|
||||||
|
throw new \Exception_Unauthorized(sprintf("%s do not have the permission to move records to %s", $user->get_login()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!$this->is_possible())
|
if (!$this->is_possible())
|
||||||
throw new Exception('This action is not possible');
|
throw new Exception('This action is not possible');
|
||||||
|
|
||||||
@@ -122,7 +130,8 @@ class MoveCollection extends RecordHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$collection = \collection::get_from_base_id($base_dest);
|
$collection = \collection::get_from_base_id($base_dest);
|
||||||
|
|
||||||
foreach ($this->selection as $record)
|
foreach ($this->selection as $record)
|
||||||
|
Reference in New Issue
Block a user