Zach Daniel
bf741990a2
improvement: add _new
options for Ash.Resource.Igniter
2024-09-15 14:53:23 -04:00
Zach Daniel
45b037e2ba
fix: ensure that field policies don't interfere with relationship loading
...
closes #1457
2024-09-12 11:12:37 -04:00
Zach Daniel
bbc59b4b7f
fix: don't generate doubly nested policies when adding policies in igniter
2024-09-11 19:59:58 -04:00
m0rt3nlund
892598e439
test: Failing tests for creating Ash.Resource.Action validation using DSL builder ( #1454 )
...
* Add build_action_validation to Ash.Resource.Builder
* Add test for Ash.Resource.Builder
---------
Co-authored-by: morten.lund@maskon.no <morten.lund@maskon.no>
2024-09-11 16:32:18 -04:00
Jonatan Männchen
0ea5ce64b6
fix: Handle Ash.Query.filter for array values ( #1452 )
...
* Refactor Ash.Filter.parse_predicates/3
* Handle Ash.Query.filter for array values
2024-09-11 15:28:08 -04:00
Zach Daniel
8f0621378a
test: add test for manage relationship error paths
2024-09-11 15:24:33 -04:00
Zach Daniel
cb3facb519
fix: we cannot assume that after_action/1
can be done atomically
...
The reason for this is that a given change may access `changeset.data`
which will not be available. This may introduce compile errors for some users
unfortunately, there is nothing we can do about this. They will need to change
to writing custom changes w/ the `atomic/3` callback that adds an after action
hook
improvement: honor a `_union_type` type param when casting unions
2024-09-11 09:57:22 -04:00
Zach Daniel
e33dc23a07
improvement: support select_by_default?
flag on attributes
2024-09-10 13:24:56 -04:00
Zach Daniel
4f31109bd9
fix: support passing a forbidden error to policies per the docs
...
fixes #1443
2024-09-07 07:51:01 -04:00
Zach Daniel
be807aa9e2
fix: don't select destination attributes that don't exist
2024-09-06 09:56:00 -04:00
b97040c9c4
chore: Add failing test for loading attributes of no-attribute relationships. ( #1438 )
2024-09-06 09:50:37 -04:00
Zach Daniel
5f5cccc2ea
improvement: show informative error explaining the use of filter checks with create actions
...
improvement: show the actor's primary key in policy breakdowns
improvement: add an expanded description option to checks
improvement: use expanded description to display filled in filter templates in policy breakdowns
2024-09-06 09:46:27 -04:00
Zach Daniel
90332d01f2
fix: use consistent naming for configurations
...
closes #1436
2024-09-04 22:41:05 -04:00
e6a7006c30
feat(Ash.Reactor): Add load
option to existing actions, and add new step type. ( #1435 )
2024-09-05 13:59:22 +12:00
Zach Daniel
d6a973cef0
improvement: better error messages on incorrect action types
2024-09-04 20:41:56 -04:00
Zach Daniel
d144be692e
fix: properly await tasks from lazy loading multiple relationships
2024-09-04 10:32:34 -04:00
Zach Daniel
06cd509e1f
chore: make the new policy behavior opt-in with config
2024-09-03 22:22:46 -04:00
Andreas Donig
de0f72b475
Fix: honor bulk upsert condition ( #1432 )
...
* Require Ash.Expr to make sure upsert_conflict/1 is available
* Make sure it correctly tests opts[:upsert_condition] for nilness
* Make sure the base changeset also adheres to the upsert condition
* Revert the changes so we can show the problem with a test case
* Add a test case that shows what the problem is
* Add the upsert_condition filter to the base changeset again
* Change the way the test checks because bulk_create/4 does not return unchanged records
2024-09-03 16:23:12 -04:00
Zach Daniel
1002d8178e
improvement: make read policies more consistent, always preferring to filter over raise
...
docs: document access type
2024-09-02 14:11:09 -04:00
Zach Daniel
6f2a14715d
improvement: show an explanation when no policies apply
2024-09-02 12:48:36 -04:00
Zach Daniel
c7eaabdb2e
fix: correctly handle return values of batch callbacks ( #1424 )
...
* improvement: factor out static branches at compile time
---------
Co-authored-by: Hannes Wüthrich <hannes.wuethrich@zebbra.ch>
2024-08-31 15:53:14 -04:00
Zach Daniel
4adddcdd69
Revert "improvement: make authorization failures behave consistently across reads"
...
This reverts commit ffa37d0c95
.
2024-08-30 19:51:46 -04:00
Zach Daniel
ffa37d0c95
improvement: make authorization failures behave consistently across reads
2024-08-30 19:45:28 -04:00
Rebecca Le
cc55670c7f
bug: Add failing test for lazy-reloaded calculations that aren't loading their dependencies ( #1420 )
2024-08-30 18:29:38 -04:00
Zach Daniel
cb80df9ed8
test: test new default keyset pagination
2024-08-30 17:36:10 -04:00
Zach Daniel
9b0fb15ecb
fix: honor the countable
option in pagination
...
the default unfortunately had to be changed to `true`, given that it was being ignored before
chore: clean up error declarations
2024-08-30 15:34:40 -04:00
Zach Daniel
0007d0e60a
fix: return proper data shape when doing a read in a transaction
...
closes #1410
2024-08-30 15:19:38 -04:00
Jinkyou Son
e2731ecd2d
Replace PaginationNotSupported exception with ActionRequiresPagination exception ( #1411 )
2024-08-30 13:11:46 -04:00
Hannes Wüthrich
4a75743812
Fix generated change/3
function when only implementing batch_change/3
( #1415 )
2024-08-28 08:04:52 -04:00
Zach Daniel
b841eaf54c
chore: add tests for accept & some opts improvements
2024-08-21 11:58:11 -04:00
Zach Daniel
d593e3cee9
improvement: error at compile for bypasses that will have no effect
...
chore: remove unused `checks` field from `%Ash.Policy.Authorizer.Policy{}`
2024-08-20 21:30:55 -04:00
Zach Daniel
7cf38273fa
improvement: prevent unnecessary calls to Ash.load
2024-08-20 11:55:46 -04:00
Zach Daniel
48507eac13
chore: run proper callback and test that we call the loading callback
2024-08-20 10:25:50 -04:00
Zach Daniel
51f57b6390
chore: pass context to load relationships
2024-08-20 10:18:01 -04:00
Zach Daniel
a43624c9f3
improvement: add cascade update built in change ( #1398 )
...
---------
Co-authored-by: Alykhan Jetha <aj@marketcircle.com>
2024-08-19 11:34:38 -04:00
Zach Daniel
7071884d05
improvement: optimize field checking for loading fields in query
...
improvement: allow functions in tracers for lazy loading metadata
2024-08-15 21:19:23 -04:00
Jonatan Männchen
e200b5b9d1
chore: Implement upsert_condition for bulk create ( #1389 )
2024-08-14 20:26:03 -04:00
Zach Daniel
ba30ec880e
chore: clean up tests
2024-08-14 11:46:18 -04:00
Zach Daniel
7cb3e04b2a
fix: fix ets lateral join source field usage
...
fix: properly apply distinct in ets
2024-08-14 11:11:03 -04:00
Jonatan Männchen
93775109c7
improvement: Implement condition for upsert ( #1386 )
...
Resolves #1385
2024-08-13 19:19:13 -04:00
Zach Daniel
1654ccdead
fix: properly pass actor, action, tenant etc. to lazy loaded relationships
2024-08-13 11:16:00 -04:00
Zach Daniel
dc73c3a3d5
feat: add policy groups
...
Policy groups allow you to group policies by shared conditions.
This can help simplify the mental overhead of large sets of policies.
For example:
```elixir
policies do
policy_group actor_attribute_equals(:role, :owner) do
policy action_type(:read) do
authorize_if expr(owner_id == ^actor(:id))
end
policy action_type([:create, :update, :destroy]) do
forbid_if
authorize_if expr(owner_id == ^actor(:id))
end
end
end
```
2024-08-09 16:48:54 -04:00
Zach Daniel
5a4864650b
improvement: prune calculations made unnecessary by field policies
...
closes #1356
2024-08-09 13:46:02 -04:00
Zach Daniel
2f22905ff3
chore: add better errors to help debug strange path/field errors in sort code
2024-08-08 20:26:53 -04:00
Jinkyou Son
2fc934fb61
fix: Fix error with nil value on structure types ( #1380 )
...
* Fix no cond clause evaluated to a truthy value error
* Fix error with nil value
* Add tests
2024-08-08 20:15:20 -04:00
Zach Daniel
763b0c59ed
chore: update tests to avoid flakiness
2024-08-07 19:44:01 -04:00
Zach Daniel
a719c791ba
improvement: add optimized path for casting embeds when they are simple
...
improvement: add `include_embedded_source_by_default?` config to optimize embeds
improvement: support `:fields` constraint on `:struct` type, enabling persistence
2024-08-07 16:47:01 -04:00
Jonatan Männchen
d1efc3fb6c
fix: after_batch
arguments for bulk_create
with return_records?
disabled ( #1371 )
...
Fixes #1369
2024-08-07 16:17:40 -04:00
Jonatan Männchen
4efe51418e
improvement: Warn on bulk action return_stream?
without any other return_*?
options enabled. ( #1370 )
...
Resolves #1368
2024-08-07 14:51:15 -04:00
Minsub Kim
ad1a634fc0
test: use other resource's calculation in expr ( #1365 )
2024-08-06 08:44:15 -04:00