Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8718715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:36:49+00:00 2026-06-13T06:36:49+00:00

I am using Symfony2 and I have users and roles already stored in my

  • 0

I am using Symfony2 and I have users and roles already stored in my DB. If I set something like below in security.yml it works great:

access_control:
   - { path: ^/admin, role: ROLE_ADMIN}
   - { path: ^/users, role: ROLE_MANAGER}

But I would like to store this access_control information in the database, so the user from my system can change the permissions itself by using the administrative interface.

I looked at ACL and FOSUserBundle but could not find a solution for this. I found that I could check permissions with something like if ($user->hasRole($role)) but I would need to do this in every controller.

Is there a way to define a dynamic “access_control” feature? Maybe something like redirecting the access_control to some class that could return true or false.
Any solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:36:51+00:00Added an answer on June 13, 2026 at 6:36 am

    The best way would be to setup a specific role (e.g. DB_ROLE_CHECK) that you set on your actions/services that you want validated against your database stored roles.

    Then you would create a security voter that hooks into DB_ROLE_CHECK and validates your request against your database entries.

    See:

    • Dynamically adding roles to a user
    • http://symfony.com/doc/current/cookbook/security/voters.html (Official Docs)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have different Authentication Roles set up in Symfony using the Security Bundle. *
I am using symfony 1.0 and have set routing for few URLs as below.
We are using Symfony2's roles feature to restrict users' access to certain parts of
I have a system, that has 2 roles (admins and users). Authentication made using
I' using Symfony2.1 and I want to do something like this: Welcome page before
I'm using Symfony2 to authenticate users. And I have two databases to store user
I have a Symfony 1.4 app using sfDoctrineGuardPlugin for users. I need to move
I have a question about symfony2. I have a project and I am using
Right now I'm using Doctrine2 in conjunction with Symfony2. I have an entity called
I have recently started setting up the security for my Symfony2 project. I opted

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.