zend framework how to reload session while submit the action.
user may have more than one user level permission,
i have form which contain user rights in check box,
i want to reload session values who are all currently logged in the web.
Example:am admin, currently x and y users are logged in in to the web and doing some activities, their rights are admin, super admin user rights,
i am admin i want to remove their super admin rights, if the made change than these rights changes should change immediately who currently access the web site users also.
How to achieve this in zend.
If I understand correctly, it sounds like you want to update privileges/permissions associated to a role (admin
, super-admin
, etc) and then have those updated permissions apply to all users with that role, even the ones who are already logged-in.
This is actually not a ZF-specific problem. It relates more to how you structure your session handling, in particular, whether you store the user's roles/permissions in the session, whether you query the db/datastore for those, etc.
If you store only the core user info in the session and you query for roles and permissions on each request (probably the least performant of the options), then your problem is solved. The roles and permissions have been updated in the datastore and will be reflected when you query for them.
Alternatively, if you also store the roles and permissions in the session, then you need to iterate over all active sessions, updating privileges in sessions affected by the new role. While this is technically do-able with file-based sessions, it is usually done using db-based storage for your session.
As noted elsewhere, Zend_Session
and Zend_Acl
are the components providing all this functionality. But the decision on core architecture has to precede implementation with these components.