Create an org automatically via JavaScript mapping - Fluid Topics - Latest

Fluid Topics Configuration and Administration Guide

Category
Reference Guides
Audience
public
Version
Latest

Use this method for internal realms. To create an org using the JavaScript mapping feature of the Profile mappers, proceed as follows:

  1. Go to the Authentication menu, and select the Realms tab.
  2. Edit or create an SSO realm.
  3. Select Run configuration assistant.
  4. Enter credentials for a user that belongs to the realm.

    Enter your own email address, for example.

  5. Select Search.

    The JavaScript mappings editor appears.

  6. Under JavaScript mappings, enter JavaScript code to assign users to orgs.

    For example, the following codeblock assigns users whose email address ends in @mycompany.com to the employees org, while users with an @othercompany.com email address go to the partners org.

    The key property in this example is user.orgs. Set user.orgs to an array of org names to control which orgs the user belongs to.

    let user_email = attributes.emailAddress;
    
    // Edit this object to map email addresses to orgs
    // Pattern: "@company.com": "org_name"
    let domainOrgMap = {
        "@mycompany.com": "employees",
        "@partner.com": "partners"
    };
    
    // Assign orgs based on email domain
    // IMPORTANT: user.orgs is the property that determines org membership
    // It must be set to an array of org names, for example: ["employees"]
    for (let domain in domainOrgMap) {
        if (user_email.endsWith(domain)) {
            user.orgs = [domainOrgMap[domain]];
            break;
        }
    }
    
  7. Select OK to save the profile mapper code.

  8. Select OK to save the realm.
  9. Select Save.

The org is created when the first user belonging to the org logs into Fluid Topics. Users belonging to the org receive the corresponding roles, groups, and tags upon their next login.

Log out and sign in again to immediately create the org, if you belong to it (through your email domain, for example).