private function checkEditAccess($contenttypeslug, $id)
{
// Is the record new or existing
$new = empty($id) ?: false;
/*
* Check the user is allowed to create/edit this record, based on:
* contenttype-all:
* contenttype-default:
* contenttypes:
* edit: []
* create: []
*/
$perm = $new ? "contenttype:{$contenttypeslug}:create" : "contenttype:{$contenttypeslug}:edit:{$id}";
if (!$this->isAllowed($perm)) {
$action = $new ? 'create' : 'edit';
$this->flashes()->error(Trans::__("You do not have the right privileges to {$action} that record."));
return $this->redirectToRoute('dashboard');
}
return false;
}