tags:

views:

733

answers:

1

I am using symfony 1.31 with propel ORM and sfGuardPlugin

I am about to setup groups and permissions. AFAIK, permissions map unto Credentials, and permissions can be assigned to groups.

I have two questions

  1. Suppose a user belongs to group A, and group A has credentials 'foobar'. When a user that belongs to group A logs in, does he 'automagically' get assigned credential 'foobar', or do I have to manually, add the credential to the user (by say looking up its group->permissions in the db) ?
  2. Assuming the SF framework 'automagically' takes care of user credential depending on group membership, is the effect real time, or does a user have to logout/login before the changes are applied/in effect?

[Edit]

Regarding question 1, I would be grateful for a link to (preferrably the SF official documentation - failing that, any other doc), that states that this is indeed the case.

Regarding question 2, the sfSecurityUser has addCredentials method that stores credentials in the user session. Consequently, I suspect that any group membership changes are NOT real time, so I will either have to force use to logout/login or maybe use an event listener or something.. am I right (or wrong)?

+3  A: 

EDIT:

If you set up sfGuard right then the crednetials will be automagic. In particular this requires you apps/$appname/lib/$userClass.class.php (typically MyUser.class.php) to extend sfGuardSecurityUser. Setting this up should be in the plugin readme.

As far as 2 goes, since the credentials have to be queried each request then it would happen immediately from the users perspective (unless of course youre using ajax to add a perm/crednetial).

prodigitalson
Regarding point1: tx. Problem is, I cannot find this info anywhere in the SF documentation - how do you know?. Regarding point 2, not necessarily so (AFAIK), since the sfSecurityUser has addCredential[s]() method that stores credentials in the user session. Consequently, I suspect that any group membership changes are NOT real time, so I will either have to force use to logout/login or maybe use an event listener or something.. am I right (or wrong)?
Stick it to THE MAN
Its not directly in the SF docs because its a plugin, not core. You should have a Markdown/txt version of the readme in the plugin dir structure itself OR you can read it online: http://www.symfony-project.org/plugins/sfGuardPlugin and click on the "Readme" tab link.
prodigitalson
About 2 - yeah you may actually you may be right about that... An event listener would probably be a good way - perhaps set to listen for an event kicked out of a Propel Behavior (these arent using the event system yet right?) thats fired on modification of creds.
prodigitalson
k, cool. tx for the info. I have enough to go on with now. I will accept your answer :)
Stick it to THE MAN