简体   繁体   中英

“Access denied” on one Sonata list view but not on another

I am working on a project based on Symfony 2.7 and Sonata Admin. I am logged in as a superuser, and I have two browser tabs open. On the first tab, I have successfully loaded the list view for a Video entity.

On the second tab, I try to load a new admin screen for an entity called VideoDerivative. Instead of the list view, I get an uncaught AccessDeniedException. Expanding the error shows that the following logic has been invoked in CRUDController.php:

public function listAction()
{
    if (false === $this->admin->isGranted('LIST')) {
        throw new AccessDeniedException();
    }

I find that interesting since, as I mentioned, I am able to view other entity types' list views just fine.

I'm not sure how to start debugging this. What would you do?

It turned out that I needed to create and assign these roles:

    ROLE_APP_ADMIN_VIDEO_DERIVATIVE_ALL:
        - ROLE_APP_ADMIN_VIDEO_DERIVATIVE_CREATE
        - ROLE_APP_ADMIN_VIDEO_DERIVATIVE_EDIT
        - ROLE_APP_ADMIN_VIDEO_DERIVATIVE_DELETE
        - ROLE_APP_ADMIN_VIDEO_DERIVATIVE_LIST
        - ROLE_APP_ADMIN_VIDEO_DERIVATIVE_WORKFLOW

Putting those into place (and giving my user access to them) fixed my issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM