# currentUser.groups doesn't match group\_users table

**URL:** <https://meta.discourse.org/t/currentuser-groups-doesnt-match-group-users-table/196146>\
**Category:** Development\
**Created:** [July 6, 2021, 9:19am UTC](https://meta.discourse.org/t/currentuser-groups-doesnt-match-group-users-table/196146 "2021-07-06T09:19:17Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Nacho\_Caballero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nacho_caballero/32/130189_2.png) [@Nacho\_Caballero](https://meta.discourse.org/u/Nacho_Caballero)\
**Post date:** [July 6, 2021, 9:19am UTC](https://meta.discourse.org/t/currentuser-groups-doesnt-match-group-users-table/196146/1 "2021-07-06T09:19:17Z")

</div>

I believe this is a bug, but feel free to recategorize it to #Development

## Steps to reproduce

1. Create a theme by going to Admin \> Themes \> Common \> `</head>` and paste this

2. Impersonate different users to see what groups you get

3. Go to the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) (or the DB) and run this query

## DB output

```
- 2	{1,3,10,11,12,13,14,50,63,64,68}	11

- 3	{2,3,10,11,12,13,14,53,54,59,61,75,77,79,88}	15 

- 6	{10,11,54,75,77,87}	6

```

## API output

```
- User id: 2 Group ids: 1, 3, 10, 11, 12, 13, 14, 50, 63, 64, 68 (11)

- User id: 3 Group ids: 10, 53, 54, 59, 61, 75, 79, 88 (8) <= 7 missing groups

- User id: 6 Group ids: 10, 54 (2) <= 4 missing groups

```

The DB output is correct (I can see those users do have those groups assigned in the UI), so there seems to be a problem in the API. What could be causing some groups to not get sent to `currentUser.groups`?

---

_[View the full topic](https://meta.discourse.org/t/currentuser-groups-doesnt-match-group-users-table/196146)._
