Skip to content

Using multiple roles #4

Description

@olivier3400

When you specifiy several roles une the @secure annotation an AND is done beetwen the roles.
It is more logical to do an OR as done int the JMS bundle because you can filter it in the controller function.

To do it you must change in the Lsw\SecureControllerBundle\Security\ControllerListener onKernelController function

            if (!$this->securityContext->isGranted($role)) {
                throw new AccessDeniedException(
                    'Current user is not granted required role "'.$role.'".'
                );
            }
        }

by

            if ($this->securityContext->isGranted($role)) return;
        }
        throw new AccessDeniedException('Current user is not granted');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions