Symfony ACL permissions

 ̄綄美尐妖づ 提交于 2019-12-13 07:23:00

问题


Am I doing it right?

I have a couple of entities

  • Organisation
  • Forms
  • I grant users different ACL permissions on the Organisation, based on these permission I restrict routes by using the following

    $authorizationChecker = $this->get('security.authorization_checker');
    if(false == $authorizationChecker->isGranted('VIEW',$organisation) ){
         throw new AccessDeniedException();
    }
    

    Now inside a organisation a user can create forms, but I want to restrict access to the whole form process based on if the user is a member of the organisation.

    So I have the following route for the index view of the forms

    /form/{id}
    

    and something like this for a new form, etc etc you get the drift

    /form/new/{id}
    

    And i'm passing in the Organisation based on the id, i'm then just checking the users permssions based on the ACL for the organisation and using that to determine weather they can see/create the forms

    So I'm using a ACL from the Organisation Entity to restrict working with the Form Entity

    Is this the correct way to do this? if not, how would I do it?

    来源:https://stackoverflow.com/questions/36928720/symfony-acl-permissions

    标签
    易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!