When developing an ERP5 application, one often needs to log in as a different
user to test things - especially when security system is under construction.
You have to be "zope" to edit scripts, clear cache etc, but you also want to
be "jack" to see if security machinery correctly allows and disallows Jack
from doing or seeing certain things.
Table of Contents
The Wrong Way¶
This can be achieved in a number of ways. The most straightforward - launching
a few Firefoxes at the same time - doesn't work, because Firefox recognizes it
is already running, so you end up with multiple windows of the same Firefox.
You can, of course, use another browser (e.g. Konqueror) to use another account,
but this way you quickly run short of browsers.
You can also use different firefox profiles (see above).
The Right Way¶
The best way is to take advantage of the fact that authentication is url-based -
if you use the same site but under another url, it is a different session
completely independent of the other one.
Using hosts file¶
Simply edit your /etc/hosts file:
127.0.0.1 localhost jack.localhost zope.localhost
Now you can log in to:
http://zope.localhost:9080/erp5
as zope in one tab, and to
http://jack.localhost:9080/erp5
as jack in another tab, and one tab knows nothing about the other.
Note:In such environment, it is sometimes difficult to follow
which tab is which, so for development purposes it might be a good idea to hack
erp5.css so that the screen looks different depending on who you currently are.
Using Apache¶
If your site is behind apache acting as proxy, you have to set up a number of
virtual hosts ProxyPass-ing to the same backend (refer to apache documentation
for details). This works only if your dns provides for that.
Using multiple firefox profiles¶
You can create different firefox profiles, one for each user. For this you have
to set MOZ_NO_REMOTE environment variable. Under linux, just start firefox with this command:
MOZ_NO_REMOTE=1 firefox -ProfileManager
Using Prism¶
See https://addons.mozilla.org/en-US/firefox/addon/6665 -
a Prism app runs independently of anything, so you can set up and launch any
number of browsers to test various users.
Related Articles¶