Commit 3e4e4dc
fix(projects): check membership, not access, in addUserToProject()
isUserAssignedToProject() answers "can this user reach the project",
and it returns true for every admin and owner without consulting
zp_relationuserproject at all. Using it as the idempotence check made
addUserToProject() a permanent no-op for exactly those users: an admin
could never be placed on a project team, and the caller was told
"already a member" about someone holding no relation row.
Found while wiring the first consumer — allocating an owner to a
project in PgmPro Resource Allocation reported success, emitted no
toast, and left the team unchanged.
isUserMemberOfProject() is the same query without the role
short-circuit, which is what writing a membership should be gated on.
Adds a regression test pinning the distinction: a repository where
isUserAssignedToProject returns true but isUserMemberOfProject returns
false must still insert. 42 tests / 146 assertions green.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GYSPNgLdUwEnxgYqTxMc851 parent 3ade354 commit 3e4e4dc
2 files changed
Lines changed: 37 additions & 4 deletions
File tree
- app/Domain/Projects/Services
- tests/Unit/app/Domain/Projects/Services
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2379 | 2379 | | |
2380 | 2380 | | |
2381 | 2381 | | |
2382 | | - | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
2383 | 2391 | | |
2384 | 2392 | | |
2385 | 2393 | | |
| |||
Lines changed: 28 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
706 | 706 | | |
707 | 707 | | |
708 | 708 | | |
709 | | - | |
| 709 | + | |
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
| |||
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
724 | 749 | | |
725 | 750 | | |
726 | 751 | | |
| |||
730 | 755 | | |
731 | 756 | | |
732 | 757 | | |
733 | | - | |
| 758 | + | |
734 | 759 | | |
735 | 760 | | |
736 | 761 | | |
| |||
750 | 775 | | |
751 | 776 | | |
752 | 777 | | |
753 | | - | |
| 778 | + | |
754 | 779 | | |
755 | 780 | | |
756 | 781 | | |
| |||
0 commit comments