On 8 Dec 2013, at 8:43 AM, Jonathan Lundell <jlund...@pobox.com> wrote:
> On 8 Dec 2013, at 12:46 AM, Henry Nguyen <henrynguy...@gmail.com> wrote: > >> I have an application in which users can have sub_users. Within the app, a >> user can select a sub_user, at which point, all controls become targeted to >> that selected sub_user. For example, if I select sub_user 1 and then goto >> "settings/show_settings.html," I want the show_settings.html to show >> settings only for that sub_user 1. If I navigate to another page, I want the >> controller and function to again refer only to sub_user 1. I want it to stay >> like this until I explicitly navigate to another sub_user 2. >> >> In the case of web2py's URL mapping scheme, I assume this would mean I would >> have to use 1 as the argument after every function in the URL. What's the >> best way to go about ensuring this? Is this even the best way? >> > > Consider storing the sub_user ID in your session. I should point out, though, that there's a downside to this. Suppose a user opens multiple tabs, and tries to work with different sub_users in different tabs. That will fail, because all the tabs share the same session. If that's not an issue for you, sessions are the way to go. If it is, try putting the sub_user into your forms as a hidden variable, and picking it up from vars. -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.