# Maintain roles/groups/permissions of enterprise connection users before first login?

**URL:** <https://community.auth0.com/t/maintain-roles-groups-permissions-of-enterprise-connection-users-before-first-login/8243>\
**Category:** Get Help\
**Tags:** enterprise, user, groups, connection, roles\
**Created:** [September 19, 2017, 3:39pm UTC](https://community.auth0.com/t/maintain-roles-groups-permissions-of-enterprise-connection-users-before-first-login/8243 "2017-09-19T15:39:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreasgrimm](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andreasgrimm/32/17087_2.png) [@andreasgrimm](https://community.auth0.com/u/andreasgrimm)\
**Post date:** [September 19, 2017, 3:39pm UTC](https://community.auth0.com/t/maintain-roles-groups-permissions-of-enterprise-connection-users-before-first-login/8243/1 "2017-09-19T15:39:51Z")

</div>

I want to maintain a user’s roles before his or her first login ever.

The user’s digital identity already exists within the enterpise’s Active Directory (he or she would definitely use an enterprise connection / ADFS) and thus the user’s existance is already known to me but yet unkown to Auth0 (and the Authorization Extension) .

Nevertheless I’d like to do proper upfront provisioning and to provide a good UX by the user after the very first login already being able to use a specific application in the first place and by him or her being immediately authorized within the application.

What would be the best/recommended approach for this to be done?

---

<div class="post-metadata">

**Author:** ![dan11](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan11/32/5458_2.png) [@dan11](https://community.auth0.com/u/dan11)\
**Post date:** [October 18, 2017, 5:09am UTC](https://community.auth0.com/t/maintain-roles-groups-permissions-of-enterprise-connection-users-before-first-login/8243/2 "2017-10-18T05:09:51Z")

</div>

I’m not sure if this is best practice, but I set up a Rule like so:

```
function (user, context, callback) {
  if (context.connectionStrategy === 'samlp'){
    // make an ajax call to check if user is already provisioned
    // update app_metadata or anything else if necessary
  }

  // no saml connection detected, just continue
  return callback(null, user, context);
}

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:56am UTC](https://community.auth0.com/t/maintain-roles-groups-permissions-of-enterprise-connection-users-before-first-login/8243/3 "2018-03-02T05:56:35Z")

</div>


