Hey all Was hoping to find a solution to
# avo-2
m
Hey all! Was hoping to find a solution to my problem. Is there a way to redirect a user to the index page for the first (or any) resource they are authorized to view? For context: I 'm exposing all of my resources in the main_menu, but there are certain users that are not authorized to access the index for the first resource in the menu. Because of this, when the users above visit the root_path (which is set to
/admin
), they are redirected to the index for the resource they don't have access to, then redirected to the
root_path
, ultimately resulting in a
ERR_TOO_MANY_REDIRECTS
error. I know we could add a dashboard but as of now we have no use for that. Any insight would be appreciated. Thanks!
l
Hello @mammoth-notebook-46426, there are several possible approaches. One and the simpler one in my opinion is to have a Welcome ResourceTool where all users have access, that way
ERR_TOO_MANY_REDIRECTS
should not happen. There you can add some details and relevant information about the admin panel in order to guide the users. Another approach would be to configure a lambda
home_path
on
avo.rb
initializer
Copy code
ruby
  config.home_path = -> {
    if current_user.is_admin?
      "/admin/dashboards/dashy"
    else
      "/admin/resources/users"
    end
  }