private function secure(AbstractAdmin $admin, $attributes, $object = null)
    {
        if (!is_array($attributes)) {
            $attributes = [$attributes];
        }

        if (is_null($object)) {
            // object is required at least to get the class to check permissions against in ContentVoter
            $entityClass = $admin->getEntityClass();
            $object = new $entityClass();
        }

        if (!$this->get('security.authorization_checker')->isGranted($attributes, $object)) {
            throw new AccessDeniedException();
        }
    }
private function secure(AbstractAdmin $admin, $attributes, $object = null)
    {
        if (!is_array($attributes)) {
            $attributes = [$attributes];
        }

        if (is_null($object)) {
            // object is required at least to get the class to check permissions against in ContentVoter
            $entityClass = $admin->getEntityClass();
            $object = new $entityClass();
        }

        if (!$this->get('security.authorization_checker')->isGranted($attributes, $object)) {
            throw new AccessDeniedException();
        }
    }
private function secure ( AbstractAdmin $ admin , $ attributes , $ object = null ) { if ( ! is_array ( $ attributes ) ) { $ attributes = [ $ attributes ] ; } if ( is_null ( $ object ) ) { // object is required at least to get the class to check permissions against in ContentVoter $ entityClass = $ admin -> getEntityClass ( ) ; $ object = new $ entityClass ( ) ; } if ( ! $ this -> get ( 'security.authorization_checker' ) -> isGranted ( $ attributes , $ object ) ) { throw new AccessDeniedException ( ) ; } }
Ensure a user is allowed to access an action

@throws AccessDeniedException if user is not allowed

@param mixed $attributes
@param mixed $object
Ensure a user is allowed to access an action