# 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:** 3
**Page:** 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`?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [July 6, 2021, 9:46am UTC](https://meta.discourse.org/t/currentuser-groups-doesnt-match-group-users-table/196146/2 "2021-07-06T09:46:11Z")

</div>

Is it possible that the missing groups have been configured to be hidden from the users? If so, then they won’t be included in the `currentUser` object on the client.

 ![Screenshot 2021-07-06 at 10.44.22](https://global.discourse-cdn.com/meta/original/3X/f/4/f45805bedab8b5ea92dbee19be73f17b3fa0b317.png)

---

<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:56am UTC](https://meta.discourse.org/t/currentuser-groups-doesnt-match-group-users-table/196146/3 "2021-07-06T09:56:57Z")

</div>

Ah, good point. No longer a bug then. Thanks!
