mirror of
https://github.com/ash-project/ash.git
synced 2024-09-19 13:03:02 +12:00
parent
e6a7006c30
commit
90332d01f2
5 changed files with 19 additions and 7 deletions
|
@ -29,7 +29,7 @@ if Mix.env() == :test do
|
||||||
Ash.Test.Support.PolicySimple.Domain
|
Ash.Test.Support.PolicySimple.Domain
|
||||||
]
|
]
|
||||||
|
|
||||||
config :ash, :policy, no_filter_static_forbidden_reads?: false
|
config :ash, :policies, no_filter_static_forbidden_reads?: false
|
||||||
|
|
||||||
config :ash, :custom_expressions, [Ash.Test.Expressions.JaroDistance]
|
config :ash, :custom_expressions, [Ash.Test.Expressions.JaroDistance]
|
||||||
|
|
||||||
|
|
|
@ -1559,7 +1559,7 @@ defmodule Ash.Policy.Authorizer do
|
||||||
defp forbidden_due_to_strict_policy?(authorizer) do
|
defp forbidden_due_to_strict_policy?(authorizer) do
|
||||||
no_filter_static_forbidden_reads? =
|
no_filter_static_forbidden_reads? =
|
||||||
Keyword.get(
|
Keyword.get(
|
||||||
Application.get_env(:ash, :policy, []),
|
Application.get_env(:ash, :policies, []),
|
||||||
:no_filter_static_forbidden_reads?,
|
:no_filter_static_forbidden_reads?,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
|
@ -85,7 +85,7 @@ defmodule Ash.Policy.FilterCheck do
|
||||||
|> then(fn expr ->
|
|> then(fn expr ->
|
||||||
no_filter_static_forbidden_reads? =
|
no_filter_static_forbidden_reads? =
|
||||||
Keyword.get(
|
Keyword.get(
|
||||||
Application.get_env(:ash, :policy, []),
|
Application.get_env(:ash, :policies, []),
|
||||||
:no_filter_static_forbidden_reads?,
|
:no_filter_static_forbidden_reads?,
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,10 +6,16 @@ defmodule Ash.Test.Policy.ComplexTest do
|
||||||
alias Ash.Test.Support.PolicyComplex.{Bio, Comment, Post, User}
|
alias Ash.Test.Support.PolicyComplex.{Bio, Comment, Post, User}
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
Application.put_env(:ash, :policies, show_policy_breakdowns?: true)
|
old_env = Application.get_env(:ash, :policies, [])
|
||||||
|
|
||||||
|
Application.put_env(
|
||||||
|
:ash,
|
||||||
|
:policies,
|
||||||
|
Keyword.merge(old_env, show_policy_breakdowns?: true)
|
||||||
|
)
|
||||||
|
|
||||||
on_exit(fn ->
|
on_exit(fn ->
|
||||||
Application.delete_env(:ash, :policies)
|
Application.put_env(:ash, :policies, old_env)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
me = User.create!("me", %{email: "me@app.com", bio_text: "this is my bio"}, authorize?: false)
|
me = User.create!("me", %{email: "me@app.com", bio_text: "this is my bio"}, authorize?: false)
|
||||||
|
|
|
@ -75,10 +75,16 @@ defmodule Ash.Test.Policy.SimpleTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
Application.put_env(:ash, :policies, show_policy_breakdowns?: true)
|
old_env = Application.get_env(:ash, :policies, [])
|
||||||
|
|
||||||
|
Application.put_env(
|
||||||
|
:ash,
|
||||||
|
:policies,
|
||||||
|
Keyword.merge(old_env, show_policy_breakdowns?: true)
|
||||||
|
)
|
||||||
|
|
||||||
on_exit(fn ->
|
on_exit(fn ->
|
||||||
Application.delete_env(:ash, :policies)
|
Application.put_env(:ash, :policies, old_env)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in a new issue