# Admin & Moderator roles defined in external database

**URL:** https://meta.discourse.org/t/admin-moderator-roles-defined-in-external-database/105896
**Category:** SSO
**Created:** [January 7, 2019, 10:48am UTC](https://meta.discourse.org/t/admin-moderator-roles-defined-in-external-database/105896 "2019-01-07T10:48:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Subham\_Joshi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/subham_joshi/32/127591_2.png) [@Subham\_Joshi](https://meta.discourse.org/u/Subham_Joshi)
#### Post date: [January 7, 2019, 10:48am UTC](https://meta.discourse.org/t/admin-moderator-roles-defined-in-external-database/105896/1 "2019-01-07T10:48:02Z")

</div>

Is there a way we can define admin roles & moderator roles outside the discourse.?  
As like configuration in azure AD and while logging in using Oauth2, we can fetch the roles and show them as Admin, Moderator & User.?

Is there any feature related to that or some custom plugin.? OR We need to create that from scratch.?  
Thanks for your help.! 🙂

---

<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: [January 7, 2019, 11:29am UTC](https://meta.discourse.org/t/admin-moderator-roles-defined-in-external-database/105896/2 "2019-01-07T11:29:20Z")

</div>

It is not currently possible using the OAuth2 plugin. A PR to add the functionality to the plugin would likely be accepted, or alternatively you could call the API from your main application to make the user a moderator/administrator.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 7, 2019, 1:37pm UTC](https://meta.discourse.org/t/admin-moderator-roles-defined-in-external-database/105896/3 "2019-01-07T13:37:27Z")

</div>

Can you use sso instead of oauth?

---

<div class="post-metadata">

### Author: ![Alexander\_Wright](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexander_wright/32/119518_2.png) [@Alexander\_Wright](https://meta.discourse.org/u/Alexander_Wright)
#### Post date: [January 7, 2019, 1:45pm UTC](https://meta.discourse.org/t/admin-moderator-roles-defined-in-external-database/105896/4 "2019-01-07T13:45:15Z")

</div>

I’ve been wanting to write a similar feature for some time. If / when I get around to it, I’ll happily feed it back.
