|
@@ -185,10 +185,6 @@ class CRUDController extends Controller
|
|
|
*/
|
|
|
public function deleteAction($id)
|
|
|
{
|
|
|
- if (false === $this->admin->isGranted('DELETE')) {
|
|
|
- throw new AccessDeniedException();
|
|
|
- }
|
|
|
-
|
|
|
$id = $this->get('request')->get($this->admin->getIdParameter());
|
|
|
$object = $this->admin->getObject($id);
|
|
|
|
|
@@ -196,6 +192,10 @@ class CRUDController extends Controller
|
|
|
throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
|
|
|
}
|
|
|
|
|
|
+ if (false === $this->admin->isGranted('DELETE', $object)) {
|
|
|
+ throw new AccessDeniedException();
|
|
|
+ }
|
|
|
+
|
|
|
if ($this->getRequest()->getMethod() == 'DELETE') {
|
|
|
try {
|
|
|
$this->admin->delete($object);
|
|
@@ -222,10 +222,6 @@ class CRUDController extends Controller
|
|
|
*/
|
|
|
public function editAction($id = null)
|
|
|
{
|
|
|
- if (false === $this->admin->isGranted('EDIT')) {
|
|
|
- throw new AccessDeniedException();
|
|
|
- }
|
|
|
-
|
|
|
$id = $this->get('request')->get($this->admin->getIdParameter());
|
|
|
|
|
|
$object = $this->admin->getObject($id);
|
|
@@ -234,6 +230,10 @@ class CRUDController extends Controller
|
|
|
throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
|
|
|
}
|
|
|
|
|
|
+ if (false === $this->admin->isGranted('EDIT', $object)) {
|
|
|
+ throw new AccessDeniedException();
|
|
|
+ }
|
|
|
+
|
|
|
$this->admin->setSubject($object);
|
|
|
|
|
|
$form = $this->admin->getForm();
|
|
@@ -429,10 +429,6 @@ class CRUDController extends Controller
|
|
|
*/
|
|
|
public function showAction($id = null)
|
|
|
{
|
|
|
- if (false === $this->admin->isGranted('VIEW')) {
|
|
|
- throw new AccessDeniedException();
|
|
|
- }
|
|
|
-
|
|
|
$id = $this->get('request')->get($this->admin->getIdParameter());
|
|
|
|
|
|
$object = $this->admin->getObject($id);
|
|
@@ -441,6 +437,10 @@ class CRUDController extends Controller
|
|
|
throw new NotFoundHttpException(sprintf('unable to find the object with id : %s', $id));
|
|
|
}
|
|
|
|
|
|
+ if (false === $this->admin->isGranted('VIEW', $object)) {
|
|
|
+ throw new AccessDeniedException();
|
|
|
+ }
|
|
|
+
|
|
|
$this->admin->setSubject($object);
|
|
|
|
|
|
// build the show list
|