Commit 0d4320c
Ronald A Richardson
fix: include pending-invite users in IAM user list
The UserFilter::queryForInternal() was scoped exclusively to users with
a CompanyUser row for the current company. Newly invited users have no
CompanyUser record until they accept their invite, so they were invisible
in the IAM list.
The fix adds an orWhereExists() subquery that also matches users whose
email address appears in the recipients JSON column of a non-deleted
join_company invite for the current company. This covers both the
brand-new pending user path and the cross-org invite path.
JSON_CONTAINS(invites.recipients, JSON_QUOTE(users.email)) is used
instead of whereHas() because the invites table has no user_uuid column;
the user is identified solely by their email in the recipients array.1 parent 1363cd4 commit 0d4320c
1 file changed
Lines changed: 22 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
18 | 32 | | |
19 | 33 | | |
20 | 34 | | |
| |||
0 commit comments