ash icon indicating copy to clipboard operation
ash copied to clipboard

Support bypass multi tenancy for aggregates and calculations

Open shahryarjb opened this issue 3 months ago • 3 comments

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

AI Policy

  • [x] I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.

Is your feature request related to a problem? Please describe.

No Support for Revaluation or Bypassing Multi-Tenancy in Aggregates and Calculations

Sometimes we need to bypass multitenancy, even if we use Ash.load or add read_action :read_any and add a new tendency id to it, it dose not accept.

 aggregates do
    custom :media_count, :media, :integer do
      public? true
      implementation MishkaCms.Runtime.Aggregates.MediaCountAggregate
      description "Returns total number of media files in this category using custom aggregate that bypasses multitenancy"
    end
  end

Describe the solution you'd like

If it accepts from parent

Ash.load!(category, [:media_count],
  tenant: media_query_tenant,
  authorize?: false
)

And something like multitenancy :bypass, fix the problem

Refs

  • https://discord.com/channels/711271361523351632/1426476980274200577

Describe alternatives you've considered

No response

Additional context

No response

shahryarjb avatar Oct 11 '25 11:10 shahryarjb

This would be a welcome change, PRs welcome!

zachdaniel avatar Oct 11 '25 20:10 zachdaniel

@zachdaniel it should read multitenancy from its parent action? or it should have multitenancy bypass inside itself?

shahryarjb avatar Nov 04 '25 08:11 shahryarjb

Well calculations can come from any action so they'd need to have their own config.

zachdaniel avatar Nov 04 '25 11:11 zachdaniel