Multiple Avo admin panels in one app #1709
Replies: 3 comments 1 reply
-
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.
-
Also interested in this to have a "public" interface and a "private" one. |
Beta Was this translation helpful? Give feedback.
-
Sure. Let's give an example. We track construction projects. I want people to be able to register to a "community" portal where they can suggest, edit, and submit new projects. This could be 100s or 1000s of people. They should only see their own data. On the other side, I also want our own support people to be able to see sensitive data to support our existing customers. Ideally, i'd have those be at different urls. /community for all the people who want to submit project data. |
Beta Was this translation helpful? Give feedback.
-
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