Multiple Avo admin panels in one app #1709
adrianthedev
started this conversation in
General
Replies: 1 comment
-
That being said, I do wish a feature existed with Avo where you can just specify a route segment or subdomain to be attributed to a directory and Avo will feed off that directory. This way you could have multiple configurations for multiple user types. Avo.configure do |config|
config.modules = [
{ namespace: "admins", path: "/admins" },
{ namespace: "analytics", path: "/analytics" },
]
end
# Have different configuration files under `app/admins` and `app/analytics`
# `app/admins/resources|actions|filters|etc`
# `app/analytics/resources|actions|filters|etc` The con to this is that it will be more difficult to re-use configuration files. It might be easier just to assign them to different roles somehow. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey everyone. I had this question asked a few times now. How can you have multiple Avo admin panels in one app?
Let's consider multiple roles for users (
analytics
andadmin
) and a few resourcesProduct
andUser
.The use-case here is that a member from
analytics
should not be allowed to see any users but theadmin
should.Pundit policies to the rescue! Inside your
UserPolicy
methods you would return something likeuser.is_admin?
in all policy methods.Now, only the user that has the role of
admin
will be see theUser
resource and none other.All throughout Avo (in actions, filters, dashboards, etc.) you have
authorization
orvisible
options where you can add the same constraint.I'm curious to see if anyone used this before or has found different ways of achieving this behavior.
✌️ Adrian
Beta Was this translation helpful? Give feedback.
All reactions