Bolt\Controller\Backend\Records::checkEditAccess PHP Method

checkEditAccess() private method

Check that the user is allowed to edit the record.
private checkEditAccess ( string $contenttypeslug, integer $id ) : boolean | RedirectResponse
$contenttypeslug string
$id integer
return boolean | Symfony\Component\HttpFoundation\RedirectResponse
    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;
    }