openanalytics / shinyproxy

ShinyProxy - Open Source Enterprise Deployment for Shiny and data science apps
https://www.shinyproxy.io
Apache License 2.0
525 stars 151 forks source link

issues/269 redirect user to first available app when proxy.landing-page=auto #448

Closed nickmelis closed 6 months ago

nickmelis commented 1 year ago

Allows ShinyProxy to use the first available app for a logged-in user as landing page, bypassing the built-in index page. This can be used when different permissions for different users makes it impractical to identify an app which is accessible by all users in the system and usable as predefined landing page/app.

Please see relevant discussion here

I'm also assuming, if this is approved and merged, some documentation change will be required. Please can anyone point me to the right resources as I'm quite happy to make the changes myself if that's practical. Thanks

Testing notes: Tested with the following simple authentication configuration:

  users:
  - name: jack
    password: password
    groups: scientists
  - name: jeff
    password: password
    groups: mathematicians
  specs:
  - id: 01_hello
    display-name: Hello Application
    description: Application which demonstrates the basics of a Shiny app
    container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"]
    container-image: openanalytics/shinyproxy-demo
    access-groups: [mathematicians]
  - id: 06_tabsets
    container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"]
    container-image: openanalytics/shinyproxy-demo
    access-groups: scientists
LEDfan commented 1 year ago

Hi, thanks for the PR! The code looks fine on first sight, but I have some doubts with the exact feature. If this option is enabled, the user is redirected to the first app, but that means they can never see the list of other apps. I guess your way of solving this is by having a navbar containing the list of apps (#449 ).

With the discussing in #269 I assumed that you would redirect only when the user has access to a single app. Maybe it would make sense to implement both these behaviors:

proxy:
   landing-page: FirstApp

The above configuration would redirect the user to the first app, no matter how many apps they can access.

proxy:
   landing-page: SingleApp

The above configuration would redirect the user only if they have access to a single app.

What do you think?

nickmelis commented 1 year ago

The above configuration would redirect the user only if they have access to a single app.

So, technically speaking (just checking if I understood correctly):

if (apps.length == 1 && landingPage.equals("SingleApp")
-> then only in this case redirect to the only available app

whereas

if (apps.length > 0 && landingPage.equals("FirstApp")
-> then redirect to the first available app

@LEDfan if that's what you had in mind, I'm happy to tweak my PR (shouldn't take long). Thanks

LEDfan commented 1 year ago

Exactly, would be great, thanks!

nickmelis commented 1 year ago

I can see how both of these can be very useful, SingleApp in case of an installation with literally just one app. In which case, no need for an index page or even a navbar. Will get straight to work 😃

nickmelis commented 1 year ago

@LEDfan just pushed some changes to reflect what we just discussed. Let me know what you think

danielloader commented 1 year ago

@LEDfan any movement on this? This would be a great addition.

LEDfan commented 1 year ago

hi @danielloader I'll include this in the next release, but I don't have an ETA yet.

LEDfan commented 6 months ago

Hi, this is now part of the ShinyProxy 3.1.0 we released today. Thanks again for your contribution!