Error to use `filter expr` with `manage_relationship` Unknown Error

Hi dear friends! i have a relation like this, as you see i added filter expr to prevent user not send request when they are not master user (without tenant and site_id)
has_many :master_versions, MishkaDocument.WorkspaceVersion do
public? true
destination_attribute :workspace_id
read_action :read_any
description "All versions of this workspace (master admin access, bypass tenant)"
filter expr(is_nil(type(^actor(:tenant_id), :uuid)))
end
has_many :master_versions, MishkaDocument.WorkspaceVersion do
public? true
destination_attribute :workspace_id
read_action :read_any
description "All versions of this workspace (master admin access, bypass tenant)"
filter expr(is_nil(type(^actor(:tenant_id), :uuid)))
end
and inside my create i have this
change manage_relationship(:version_ids, :master_versions,
type: :append_and_remove,
on_no_match: :error,
on_match: :ignore
)
change manage_relationship(:version_ids, :master_versions,
type: :append_and_remove,
on_no_match: :error,
on_match: :ignore
)
But i get this error
** (Ash.Error.Unknown)
Bread Crumbs:
> Exception raised in: MishkaDocument.WorkspaceVersion.read
> Exception raised in: MishkaDocument.Workspace.master_create

Unknown Error

* ** (RuntimeError) Unsupported expression in Elixir.AshPostgres.SqlImplementation query: {:_actor, :tenant_id}
** (Ash.Error.Unknown)
Bread Crumbs:
> Exception raised in: MishkaDocument.WorkspaceVersion.read
> Exception raised in: MishkaDocument.Workspace.master_create

Unknown Error

* ** (RuntimeError) Unsupported expression in Elixir.AshPostgres.SqlImplementation query: {:_actor, :tenant_id}
is there prevent user not to send request here not the relation resource policy? By the way i bypassed it with another ways, but is there any way for it? when tenant dose not exist Thank you
2 Replies
ZachDaniel
ZachDaniel2mo ago
I don't believe we support actor templates in relationship filters
Shahryar
ShahryarOP2mo ago
For now i just use it for read, and for update and create in the action i set tenant to prevent error

Did you find this page helpful?