-6

In my app I want to check if another user of the app can access a specific route.

How to use the security compoment of Symfony to load the target user context and check the right as if the user call the URL ?

EDIT :

I known the documentation of Symfony2. But all oriented for current logged user. But in my case, I'm an admin and I want share the current page with another admin.

Before send the share email, I want check if the another admin can read the shared page.

2 Answers2

0

You should use ACL or Voter to achieve your needs.

Houssem ZITOUN
  • 644
  • 1
  • 8
  • 23
Jean-Luc Barat
  • 1,147
  • 10
  • 18
0

My solution :

1) create a token \Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken with user.

2) use the 'security.access.decision_manager' for decide if the user have the granted access.

This solution is simple but not shared here.

goto
  • 7,908
  • 10
  • 48
  • 58