Repository navigation
Commit 681efb5
committed
fix(ri-exchange): address CodeRabbit findings on PR #590 (review 4357903828)
Finding 1 (Major): canApproveRIExchangeRow now uses canAccess() for both
admin/* and approve-any:purchases holders; approve-own:purchases replaces
the bare user-id equality check. Non-admin approve-any holders can now
see and click the Approve button.
Finding 2 (Minor): split approveRIExchange's single try/catch into two
blocks so a refresh failure no longer triggers the "Failed to approve"
error toast. Approval and history reload are independent failures.
Finding 3 (Minor): three test call sites that silently discarded the
returned err now capture it and assert require.NoError, ensuring
regressions surface instead of passing on side-effect checks alone.
Finding 4 (Major): when sessionHasApproveRight passes but
approveRIExchangeViaSession returns permission-denied (approve-own user
not the creator), fall through to the token path if a token is present
instead of returning the 403. Legacy email-link approval now works for
this RBAC shape.1 parent 7293268 commit 681efb5
3 files changed
Lines changed: 44 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1014 | 1014 | | |
1015 | 1015 | | |
1016 | 1016 | | |
1017 | | - | |
| 1017 | + | |
1018 | 1018 | | |
1019 | | - | |
| 1019 | + | |
1020 | 1020 | | |
1021 | 1021 | | |
1022 | 1022 | | |
| |||
1118 | 1118 | | |
1119 | 1119 | | |
1120 | 1120 | | |
1121 | | - | |
1122 | 1121 | | |
1123 | 1122 | | |
1124 | 1123 | | |
1125 | 1124 | | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
1126 | 1132 | | |
1127 | 1133 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
793 | 793 | | |
794 | 794 | | |
795 | 795 | | |
796 | | - | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
797 | 805 | | |
798 | 806 | | |
799 | 807 | | |
| |||
802 | 810 | | |
803 | 811 | | |
804 | 812 | | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
| 813 | + | |
| 814 | + | |
809 | 815 | | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
| 816 | + | |
| 817 | + | |
817 | 818 | | |
818 | | - | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
819 | 826 | | |
820 | 827 | | |
821 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
822 | 837 | | |
823 | 838 | | |
824 | 839 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | | - | |
| 356 | + | |
| 357 | + | |
357 | 358 | | |
358 | 359 | | |
359 | 360 | | |
| |||
403 | 404 | | |
404 | 405 | | |
405 | 406 | | |
406 | | - | |
| 407 | + | |
| 408 | + | |
407 | 409 | | |
408 | 410 | | |
409 | 411 | | |
| |||
463 | 465 | | |
464 | 466 | | |
465 | 467 | | |
466 | | - | |
| 468 | + | |
| 469 | + | |
467 | 470 | | |
468 | 471 | | |
469 | 472 | | |
| |||
0 commit comments