简体   繁体   中英

How to create restricted and non restricted area same time in Symfony2

what i have to build is page that have some pages that are restricted and some are not on similar links. I`ll try to explain it on example:

Let's say that i have users in my system (based on FOSUserBundle), and each of them have own account that contains a Blog and Gallery (different controllers). Some of User want to give access to thier Blog and Gallery only for certain group of people (that are not stored in system), so they generate token (only one token, so whoever know token will be able to access area) and sends to Users. What i don`t want to do is to check it in each method of controllers.

So let`s say we have 2 users, steven and stan and first of them want to make his blog and gallery free to see, but second one want to be restricted based on token.

Link would be like this:

/steven/blog
/steven/gallery

/stan/blog
/stan/gallery

Could anybody recommend some solution or any idea how can i try to build it in Symfony2?

Why don't you want to check it into the controllers ? I don't see any others ways to do that, according you want it to be dynamic and possibly changing.

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