-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: multiple filter-checks in policy conditions were not composing p…
…roperly
- Loading branch information
1 parent
3057c4d
commit adda852
Showing
5 changed files
with
75 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
defmodule Ash.Test.Support.PolicySimple.TwoFilters do | ||
@moduledoc false | ||
|
||
use Ash.Resource, | ||
domain: Ash.Test.Support.PolicySimple.Domain, | ||
data_layer: Ash.DataLayer.Ets, | ||
authorizers: [Ash.Policy.Authorizer] | ||
|
||
ets do | ||
private?(true) | ||
end | ||
|
||
actions do | ||
defaults [:read, create: [:user_id]] | ||
end | ||
|
||
attributes do | ||
uuid_primary_key :id | ||
end | ||
|
||
relationships do | ||
belongs_to :user, Ash.Test.Support.PolicySimple.User | ||
belongs_to :user2, Ash.Test.Support.PolicySimple.User | ||
end | ||
|
||
policies do | ||
policy relates_to_actor_via(:user) do | ||
authorize_if always() | ||
end | ||
|
||
policy relates_to_actor_via(:user2) do | ||
authorize_if always() | ||
end | ||
end | ||
end |