Search code examples
phpmysqlsymfony1doctrinesfdoctrineguard

with Symfony sfDoctrineGuardPlugin, i need to have user group and some settings for permissions etc


its my first real project with Symfony. i need to have some settings like permissions on my backend application.

i know, i must do it with sfDoctrineGuardPlugin. but i don't know how? i have read everthing about sfDoctrineGuardPlugin on symfony website. but i still don't find anything about;

  • how to implements user groups? i need superadmin (i did it), chief editor, editor, author.
  • how to set permissions between them? For example, every author just see their own data. editors can edit what author wrote...

thanks a lot in advanced...


Solution

  • sfDoctrineGuardPlugin is version 1.4, but should use now symfony2. Anyway, you could use sfDoctrineGuardPlugin + sfDoctrineApplyPlugin. The first is for permissions control and the second if for all the referent about forms and email in the fronted.

    Install the plugins is easy check this to links:

    Inside all your backend modules, you'll have to create one folder with "config" name inside on it one file with security.yml with this example content:

    sets:
     is_secure: true
    index:
     is_secure: true
    

    with this, you'll tell to symfony that can the user read or not. Check this url for more information:

    # http://www.symfony-project.org/reference/1_4/en/08-Security

    If you want protected all the backend with the same permissions put the same folder with the same file inside your application.