We're Hiring!

redirect after login to specific "user" for public repo

Having a problem deploying OMERO? Please ask new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

The OMERO.server installation documentation begins here and you can find OMERO.web deployment documentation here.

redirect after login to specific "user" for public repo

Postby dsudar » Tue Jun 27, 2017 11:52 pm

Hi all,

I have a public OMERO installation on: https://www.lincsclarion.org and have imported all the data into the public group as a different user. So when "public" auto logs in, he/she doesn't see any data but needs to navigate to the "MEP LINCS" user to see all the data: https://www.lincsclarion.org/webclient/ ... imenter=52

It appears that the "omero.web.login_redirect" property allows me to change it so anyone coming in will be re-directed to something but i'm afraid I cannot understand what arguments I should use to make that happen. Hopefully a quick hint will help me on my way.

Second I want to make sure this instance is somewhat secured. I applied the line:
Code: Select all
$ bin/omero config set omero.web.public.url_filter '^/(webadmin/myphoto/|webclient/(?!(action|logout|annotate_(file|tags|comment|rating|map)|script_ui|ome_tiff|figure_script))|webgateway/(?!(archived_files|download_as)))'

and it looks like I should also somehow disable the scripts as well. Is that best done with "omero.client.scripts_to_ignore" or by entirely removing the scripts from scripts directory? Note that this server is dedicated to be a public server.

Thanks,
- Damir
dsudar
 
Posts: 235
Joined: Mon May 14, 2012 8:43 pm
Location: Berkeley, CA, USA

Re: redirect after login to specific "user" for public repo

Postby wmoore » Wed Jun 28, 2017 9:47 am

Hi Damir,

I'm afraid that we don't provide the exact functionality you're asking for.
The "omero.web.login_redirect" is only used when a user actually logs in (not when they're already logged in or auto logged in as a public user, since they may then be visiting another page of their choosing and not want to be redirected.

We do provide a custom template option for visitors to the "home" url (e.g. https://www.lincsclarion.org/) but this doesn't include redirection functionality out of the box.
However, you can provide a page that visitors will see at that location, and the page itself could redirect users via JavaScript if desired.

For example, if you create a file called "lincs_index.html" with some content like this
Code: Select all
<!DOCTYPE html>
<html>
Redirecting to <a href="{% url 'webindex' %}?experimenter=52">MEP LINKS</a>...
<script>document.location.href = "{% url 'webindex' %}?experimenter=-52"</script>
</html>


and saved it somewhere that Django can read it, e.g. /path/to/custom_templates/lincs_index.html
Then do:
Code: Select all
# NB: single quotes around double quoted string
$ bin/omero config append omero.web.template_dirs '"/path/to/custom_templates/"'
$ bin/omero config set omero.web.index_template lincs_index.html


Then restart web and you should find that going to https://www.lincsclarion.org/ should show that page and the JavaScript there will redirect you to /webclient?experimenter=-52.
Of course, you may wish to design a nice looking home page there and let users click through to see the data, as we do at http://idr.openmicroscopy.org/ or you can provide a page that looks like the login page by using this as an example: https://github.com/openmicroscopy/openm ... index.html. You can see this in action at http://idr.openmicroscopy.org/index/.

You could prevent scripts being run by adding 'script_run' to the urls that are excluded from public access but you might find it simpler to just remove the scripts from the directory. The "scripts to ignore" setting is simply to omit scripts from the Scripts menu UI and doesn't prevent them from being run.

Hope that helps,

Will.
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: redirect after login to specific "user" for public repo

Postby dsudar » Mon Jul 03, 2017 5:58 pm

Thanks Will.

I'm now indeed looking at doing the same as you guys did for IDR, have a true landing page for users and send folks to the appropriate places in OMERO from there.

And indeed, I'll simply remove the scripts from the directory.
Cheers,
- Damir
dsudar
 
Posts: 235
Joined: Mon May 14, 2012 8:43 pm
Location: Berkeley, CA, USA


Return to Installation and Deployment

Who is online

Users browsing this forum: No registered users and 1 guest

cron