# Datagerry Active Diretcory Group Mapping advise

**URL:** https://community.datagerry.com/t/datagerry-active-diretcory-group-mapping-advise/608
**Category:** Community Support
**Created:** [June 17, 2024, 10:52am UTC](https://community.datagerry.com/t/datagerry-active-diretcory-group-mapping-advise/608 "2024-06-17T10:52:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sink1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.datagerry.com/sink1/32/790_2.png) [@sink1](https://community.datagerry.com/u/sink1)
#### Post date: [June 17, 2024, 10:52am UTC](https://community.datagerry.com/t/datagerry-active-diretcory-group-mapping-advise/608/1 "2024-06-17T10:52:19Z")

</div>

HI,

I set-up DG to use our AD.

Users can authenticate, and a local user is then created in DG. All good.

I would like a default group placement of Viewer, which works.

Some subsets of users must be Users whilst others must be Administrators. Unfortunately, I have ben unable to get this works.

This the configuration that I added to the Authentication tab:

**Search**

```auto
Search filter: OU=PERS USR,OU=USR,DC=example,DC=local
BaseDN: (cn=%username%)

```

**Group Mapping**  
`Search Filter: (memberOf=%username%)`

```auto
LDAP DN: Group:
CN=DEVDG_DATAGERRYADMIN,OU=Organisational,OU=GRP_DATAGERRY,OU=GRP_BB,DC=example,DC=local Administrator
CN=DEVDG_DATAGERRYUSER,OU=Organisational,OU=GRP_DATAGERRY,OU=GRP_BB,DC=example,DC=local User

```

When a user logs into DG, then they are only assigned Viewer, but never Administrator or User roles.

Also saw these messages in the log files when users log in. I do not know if these are relevent:

```auto
[WARNING] --- [LdapAuthenticationProvider] UserModel exists on LDAP but not in database: Error while GET: User with the query: {'user_name': 'kate'} not found! (external_providers.py)
[DEBUG] --- [LdapAuthenticationProvider] Try creating user: kate(external_providers.py)
[DEBUG] --- [LdapAuthenticationProvider] New user was init (external_providers.py)

```

Have you got any ideas on how how the group mapping ought to work, and why my setup might not?

Many thanks!

S

---

<div class="post-metadata">

### Author: ![sink1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.datagerry.com/sink1/32/790_2.png) [@sink1](https://community.datagerry.com/u/sink1)
#### Post date: [June 17, 2024, 12:50pm UTC](https://community.datagerry.com/t/datagerry-active-diretcory-group-mapping-advise/608/2 "2024-06-17T12:50:49Z")

</div>

A colegue solved the problem. Add some brackets to the Group search filter.

Added here for future reference:

`(member=CN=%username%,OU=PERS USR,OU=USR,DC=example,DC=local)`
