BeaconCMS / beacon_live_admin

Phoenix LiveView Admin Panel to manage Beacon CMS sites.
https://beaconcms.org
MIT License
55 stars 22 forks source link

Add :site Option to beacon_live_admin to Allow Scoping and Multiple Admins per Router #298

Open Arzamendiaariel opened 1 day ago

Arzamendiaariel commented 1 day ago

It would be helpful if beacon_live_admin could accept a :site option to scope the admin interface to a specific site. Additionally, this feature should support defining multiple admin interfaces per router. This enhancement will improve flexibility and support more complex multi-tenant or multi-site applications.

Proposed Use Case:

For example, in my application, I would like to define two different admin interfaces:

One scoped to agencies, using a site specific to the agency:


scope "/agencies/:agency_id/admin", MyAppWeb, as: :agency_admin do
  pipe_through [:browser, :agency_admin]
  beacon_live_admin "/",
    site: :agency_site,
    repo: MyApp.Repo,
    endpoint: MyAppWeb.Endpoint,
    router: MyAppWeb.Router
end

Another general admin interface for the entire application:

scope "/admin", MyAppWeb do
  pipe_through [:browser, :general_admin]
  beacon_live_admin "/",
    site: :general_site,
    repo: MyApp.Repo,
    endpoint: MyAppWeb.Endpoint,
    router: MyAppWeb.Router
end

Benefits:

Allow scoping of admin interfaces to specific sites for better multi-site management. Enable defining multiple beacon_live_admin instances within the same application, addressing use cases for multi-tenancy and granular admin interfaces. Proposed Implementation:

Add support for a :site option in the beacon_live_admin macro. Ensure compatibility with existing options like repo, endpoint, and router. Allow configuration of multiple admins per router, scoped as needed. Potential Challenges:

Handling overlapping configurations when multiple admin scopes exist in the same application. Ensuring backward compatibility for existing implementations. Conclusion:

This feature would greatly enhance the flexibility and applicability of beacon_live_admin for projects requiring scoped admin interfaces and multiple admin setups. I’d be happy to discuss further or help with implementation if needed.

Thank you for considering this feature request!

leandrocp commented 16 hours ago

Related to #272