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

  • Home
  • SEARCH
  • 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 3483570
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:41:24+00:00 2026-05-18T10:41:24+00:00

I am doing new project in symfony1.4. Now this project requires users to log-in

  • 0

I am doing new project in symfony1.4. Now this project requires users to log-in and browse, and as any project of this type requires a way of restricting users based on roles.
I don’t want to implement this in obvious way, i.e to have roles attribute for each user and have pre-defined roles and assign these to users. The problem with this is it’s not very flexible as more roles get defined later.

I was thinking on the lines of using an EAV model here, (not sure I can do that in symfony). What you guys think, do you have any better suggestions to make user roles much more flexible when they get added or deleted.

Also, what is the best way to display the page based on user roles, as I want some elements to be hidden according to the roles. Should I compare the role in each page and hide elements on every page? Is there a better solution?

Please shed some light on these.

Thanks

  • 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-05-18T10:41:24+00:00Added an answer on May 18, 2026 at 10:41 am

    The sfDoctrineGuard plugin (http://www.symfony-project.org/plugins/sfDoctrineGuardPlugin) is a pretty comprehensive way of handling user authentication, groups and credentials. Users can be set permissions either individually or as a group, and access to specific page sections or entire actions can be restricted based on those permissions. You can set new user credentials in the controller code itself, e.g.

    <?php
    $this->getUser()->setCredential('editor');
    ?>
    

    And verify that a user has particular permissions in views:

    <?php
    if ($sf_user->hasCredential('editor')) {
      // stuff only for editors
    }
    ?>
    

    This page has lots of extra info on the plugin not covered by the readme file – http://trac.symfony-project.org/wiki/sfGuardPluginExtraDocumentation (although it refers to Propel rather than Doctrine). Also the following series of short tutorials is pretty useful:

    http://www.finalconcept.com.au/article/view/symfony-user-management-sfdoctrineguard-installation

    http://www.finalconcept.com.au/article/view/symfony-user-management-sfdoctrineguard-administration

    http://www.finalconcept.com.au/article/view/symfony-user-management-sfdoctrineguard-securing-actions

    And the Symfony tutorial page on users:

    http://www.symfony-project.org/jobeet/1_4/Doctrine/en/13

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I started doing a new project in PHP / MySql . The Aim of
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
I'm doing these steps: Create new vs2010 C# console application Project menu -> Add
I am new to Entity Framework. I am currently doing a project in ASP.NET,
The new Basecamp is doing it, as it can be seen in this link
I'm about to start a new project which would allow users to navigate through
This has only started happening with ios6, but if you start a new project
Doing some initial research on a new project and one of my requirements is
I'm starting a new project, trying to do things right this time(so more than
I have been doing so research lately for a new project and have ended

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.