Upon login, store response.session_id or response.session_filename in an extra field in db.auth_user. That will make it easier to retrieve the session of any given user. If you want to update a session file, be sure to lock it first.
Maybe have a look at the session code for some ideas: https://github.com/web2py/web2py/blob/master/gluon/globals.py#L1202 Anthony On Wednesday, January 20, 2016 at 12:29:10 AM UTC-5, [email protected] wrote: > > Please elaborate on how I can do this manually. Thanks. > > On Thursday, January 7, 2016 at 7:26:15 PM UTC+5, Anthony wrote: >> >> auth.user_groups is stored in the user's session. If you (as an admin) >> make a change in the database, that will not affect the session of another >> user (which is stored in a file). We should probably make it easier to >> change content in a user's session (possibly by storing the name of the >> session file in db.auth_user -- for now, as a workaround, you could do this >> manually). >> >> Anthony >> >> On Thursday, January 7, 2016 at 5:37:27 AM UTC-5, [email protected] >> wrote: >>> >>> Database tables. >>> >>> *auth_group* >>> >>> *| id | role | Description |* >>> >>> | 1 | admin | Admin user | >>> >>> | 2 | support | Support user | >>> >>> | 3 | client | Client user | >>> >>> >>> *auth_membership* >>> >>> *| id | user_id | group_id |* >>> >>> | 1 | 1 | 1 | >>> >>> | 2 | 1 | 3 | >>> >>> >>> Right now the user is present in two groups (Admin and Client). If I print >>> the user's groups using auth.user_groups.values(); I get, >>> >>> ['admin', 'client'] >>> >>> But the problem is, when I change the group of the user to this, >>> >>> >>> *auth_membership* >>> >>> *| id | user_id | group_id |* >>> >>> | 1 | 1 | 1 | >>> >>> | 2 | 1 | 2 | >>> >>> >>> and then print the user groups, I still get the same values >>> >>> ['admin', 'client'] >>> >>> instead of, >>> >>> ['admin', 'support'] >>> >>> But if I logout, then log back in and then print the values, then I get the >>> desired output. >>> >>> How should I get the updated user groups without having to log in again? >>> Shouldn't web2py update the user groups in all places (when the user_groups >>> has been updated)? >>> >>> >>> P.S I have used auth.has_membership() but that does not suit my needs >>> because I need a list of user groups for the logged in user. >>> >>> Thanks in advance. >>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

