Skip to content

Populate user types: add user classification method #9952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 35 additions & 20 deletions content/en/docs/deployment/general/populate-user-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,12 @@ In your Mendix Pricing Plan there is a distinction between Internal and External

## Background

Every Mendix app has a system module containing an entity `UserReportInfo`. This entity has an attribute `UserType` that is used to classify end-users as External or Internal Users. This attribute needs to be maintained for all existing and new end-users of a Mendix app. If this attribute is not set, the end-user is classified as an Internal User.
Every Mendix app has a system module containing an entity `UserReportInfo`. This entity has an attribute `UserType` that is used to classify end-users as `External` or `Internal` Users. This attribute needs to be maintained for all existing and new end-users of a Mendix app. If this attribute is not set, the end-user is classified as an Internal User.

The *Mendix Metering* module relies on this attribute to ascertain the end-user type and report it back to us.

{{< figure src="/attachments/deployment/general/populate-user-type/user-type-enumeration.png" class="no-border" >}}

## Assigning UserType for Existing Users of IAM Modules

The simplest method to set the user type is by using the Identity and Access Management (IAM) modules, which require only configuration without the need to develop a microflow. Mendix offers you the following IAM modules:

* [OIDC](https://docs.mendix.com/appstore/modules/oidc/)
* [SCIM](https://docs.mendix.com/appstore/modules/scim/)
* [SAML](https://docs.mendix.com/appstore/modules/saml/)

Alternatively, you can build a custom microflow as described in the [Populating UserType for Existing Users of an App](#using-microflow) section below.

When connecting your app with an IdP, set up the user type through the capabilities of the OIDC SSO, SCIM, or SAML module. The user type is now configured in the User Provisioning, which is integrated into the OIDC SSO, SCIM, and SAML modules. This means you can directly configure end-users of your application as `internal` or `external` in the **User Provisioning** tab of your app. Based on this configuration, users are updated each time they log in. These modules allow you to set the user type per IdP as the source of your end-users, assuming that separate IdPs are used for `internal` and `external` users.

For more information, refer to the User Provisioning section of the following modules:

* [OIDC SSO](/appstore/modules/oidc/#custom-provisioning-rt)
* [SCIM](/appstore/modules/scim/#user-provisioning)
* [SAML](/appstore/modules/saml/#custom-provisioning-rt)

## Assigning UserType Using a Microflow

{{% alert color="info" %}}
Expand All @@ -63,7 +45,7 @@ Therefore, the approach we take is to create a new non-persistable entity, `User

{{< figure src="/attachments/deployment/general/populate-user-type/usertypereport-properties.png" class="no-border" >}}

### Populating **UserType** for Existing Users of an App {#using-microflow}
### Populating `UserType` for Existing Users of an App {#using-microflow}

1. Create a microflow `User_RetrieveOrCreateUserReportInfo` which will ensure that a `UserReportInfo` object exists for a given `User`.

Expand Down Expand Up @@ -98,6 +80,39 @@ Therefore, the approach we take is to create a new non-persistable entity, `User

7. The report can be exported into an Excel file.

## Assigning `UserType` based on User roles

Instead of writing microflows, you can classify users as Internal or External using roles in the User Classification module. To do this:

1. Define roles like `ExternalRole` or other custom roles.
2. Use the [User Classification](/appstore/modules/user-classification/) module to map these roles to the `UserType` field in the `UserReportInfo`.
3. When a role is assigned to a user, the UserType updates automatically.
4. This approach is simpler, more consistent, and easier to maintain than attribute-based logic.

For more information, see the [Role-based Classification](/appstore/modules/user-classification/#role-based-classification) section of *User Classification*.

## Assigning `UserType` for Existing Users of IAM Modules

The simplest method to set the user type is by using the Identity and Access Management (IAM) modules, which require only configuration without the need to develop a microflow. Mendix offers you the following IAM modules:

* [OIDC](https://docs.mendix.com/appstore/modules/oidc/)
* [SCIM](https://docs.mendix.com/appstore/modules/scim/)
* [SAML](https://docs.mendix.com/appstore/modules/saml/)

Alternatively, you can build a custom microflow as described in the [Populating UserType for Existing Users of an App](#using-microflow) section below.

When connecting your app with an IdP, set up the user type through the capabilities of the OIDC SSO, SCIM, or SAML module. The user type is now configured in the User Provisioning, which is integrated into the OIDC SSO, SCIM, and SAML modules. This means you can directly configure end-users of your application as `Internal` or `External` in the **User Provisioning** tab of your app. Based on this configuration, users are updated each time they log in. These modules allow you to set the user type per IdP as the source of your end-users, assuming that separate IdPs are used for `internal` and `external` users.

For more information, refer to the User Provisioning section of the following modules:

* [OIDC SSO](/appstore/modules/oidc/#custom-provisioning-rt)
* [SCIM](/appstore/modules/scim/#user-provisioning)
* [SAML](/appstore/modules/saml/#custom-provisioning-rt)

## Assigning `UserTypes` Using Custom logic

You can classify users as `Internal` or `External` using your own business rules instead of only roles or IAM settings. With the User Classification module and a microflow, you can combine conditions like email domains. This gives maximum flexibility to handle complex or unique scenarios and ensures accurate Mendix user metering. For more information, see the [Custom Classification](/appstore/modules/user-classification/#custom-classification) section of *User Classification*.

## Read More

* [User Classification Module](/appstore/modules/user-classification/)