Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5fef4c3
Add Backpex.Authorization module
pehbehbeh Aug 26, 2026
55f912f
Enforce authorization in Backpex.Resource mutations
pehbehbeh Aug 26, 2026
b9bdde4
Harden item id and action key entry points
pehbehbeh Aug 26, 2026
33c4abf
Gate item and resource actions before dispatch
pehbehbeh Aug 26, 2026
e65795c
Align action button state with strict enforcement
pehbehbeh Aug 26, 2026
13069ff
Migrate demo soft delete to the new Resource API
pehbehbeh Aug 26, 2026
03741e3
Add demo integration tests for authorization enforcement
pehbehbeh Aug 26, 2026
3febbc5
Document centralized authorization enforcement
pehbehbeh Aug 26, 2026
b90c580
Satisfy credo in the new authorization tests
pehbehbeh Aug 26, 2026
a85f6d8
Format demo authorization test
pehbehbeh Aug 26, 2026
0443252
Share the fake LiveResources used by the authorization tests
pehbehbeh Aug 26, 2026
26c71ee
Reject a nil :authorization_action in Backpex.Resource
pehbehbeh Aug 26, 2026
24ef454
Guard authorization entry points against a socket struct
pehbehbeh Aug 26, 2026
cccbe90
Document the removed update_all/3 in the v0.21 upgrade guide
pehbehbeh Aug 26, 2026
ab8e373
Route the remaining preflight checks through Backpex.Authorization
pehbehbeh Aug 26, 2026
8e160a8
Take fetch_action!/2 off the public LiveResource API
pehbehbeh Aug 26, 2026
d741666
Gate each item action gesture exactly once per step
pehbehbeh Aug 26, 2026
99eca56
Scope the item_action_key assign to a single dispatch
pehbehbeh Aug 26, 2026
2a60b4d
Collapse the duplicated close sequence in the item action form path
pehbehbeh Aug 26, 2026
f2019e1
Give mixed-authorization selections an affordance
pehbehbeh Aug 26, 2026
3d20897
Cover the resource action submit gate in the demo tests
pehbehbeh Aug 26, 2026
4fbc473
Correct what a raised authorization gate actually does
pehbehbeh Aug 26, 2026
701678b
Satisfy credo in the reworked item action dispatch and toolbar helper
pehbehbeh Aug 26, 2026
8f22498
remove plan document
pehbehbeh Aug 26, 2026
94d92b9
Keep the authorization guards compatible with Elixir 1.16
pehbehbeh Sep 2, 2026
59d0160
Reload the selection before the item action execution gate
pehbehbeh Sep 2, 2026
dcf9609
Cover the re-read execution gate in the demo tests
pehbehbeh Sep 2, 2026
7955634
Keep the index selection in step with updated and deleted rows
pehbehbeh Sep 2, 2026
97749cf
Document the re-read before the item action execution gate
pehbehbeh Sep 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions demo/lib/demo_web/item_actions/user_soft_delete.ex
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,23 @@ defmodule DemoWeb.ItemActions.UserSoftDelete do
try do
updates = [set: [deleted_at: datetime]]

# Backpex re-read these items and authorized exactly them under this action's key before
# calling handle/3, so the write does not check again.
{:ok, _count} =
Backpex.Resource.update_all(items, updates, "deleted", socket.assigns.live_resource)
Backpex.Resource.update_all(items, updates, socket.assigns, socket.assigns.live_resource,
event_name: "deleted",
authorize?: false
)

# nullify the user_id in the posts owned by the users
# nullify the user_id in the posts owned by the users. This is a cascade write on another
# resource, not a user-initiated action on it, so it skips authorization deliberately.
_nullified_posts =
items
|> Enum.map(fn item ->
Backpex.Resource.update_all(item.posts, [set: [user_id: nil]], "updated", DemoWeb.PostLive)
Backpex.Resource.update_all(item.posts, [set: [user_id: nil]], socket.assigns, DemoWeb.PostLive,
event_name: "updated",
authorize?: false
)
end)

socket
Expand Down
Loading