Login Modification via Web Provisioning

Hello,
I’m trying to modify the login during the provisioning process through the web interface, so that the supervisor doesn’t have to enter the login manually.

Example
User creation:
First name: Pierre
Last name: Castel
Email: pcastel@domain.com

Currently, the login generated is Pierre.Castel, but I would like it to be pcastel.
How can I achieve this?

Thank you in advance for your response.

You can apply the login creation logic from the synchronization of your authorized source into the transformation script directly, or modify the script /provision/primary/primaryPrincipal.groovy

1 Like

Ok, but I don’t understand how to modify it in the Provision script primaryPrincipal.groovy

package org.openiam

import org.openiam.api.connector.model.ConnectorAttribute
import org.openiam.idm.processor.groovy.AbstractUserPrincipalGenerator
import org.openiam.idm.provisioning.diff.model.user.ProvisionUserObjectDiff

/**

  • iam-services

  • Created by zaporozhec on 3/30/17.

  • The implementor of this class should override the provided methods.

  • The default implmeentation is in the AbstractPrincipalGenerator, which should be

  • enough for most use-cases.

  • However, we provide the ability to override the use-case functionality with something more custom.
    */
    class UserPrincipal extends AbstractUserPrincipalGenerator {

    @Override
    protected String getManageSystemId() {
    return “0”;
    }

    @Override
    boolean isPerform(final ProvisionUserObjectDiff diffObject) {
    return super.isPerform(diffObject);
    }

    @Override
    void perform(final ConnectorAttribute attribute, final ProvisionUserObjectDiff diffObject) {
    println “Attribute class: ${attribute}”
    println “Attribute Properties: ${attribute.properties}”
    println “diffObject class: ${diffObject.getClass().getName()}”
    println “diffObject properties: ${diffObject.properties}”
    def login = “testvitefait”
    attribute.setValues([login])
    super.perform(attribute, diffObject);
    }

    @Override
    void getActualValue(final ConnectorAttribute attribute, final ProvisionUserObjectDiff diffObject) {
    super.getActualValue(attribute, diffObject);
    }
    }

Miss Click: I didn’t want to send the last message so quickly. XD. I wanted to know if you had any ideas on how to modify this script.

Here’s my current script.

Hello @MarVI,

Please replace the out-of-the-box script with the one that is attached to this post.

This script automatically generates unique login names for new users. It creates logins in “firstInitialLastName” format (like “pcastel” for Pierre Castel), checks if that login already exists and if there’s a conflict, it automatically tries numbered variations (pcastel1, pcastel2, etc.) until it finds an available username.

PrimaryPrincipal.groovy (4.3 KB)

Please let me know if you have any questions.

Thanks,

Ameet

Thank you very much for the code. I’m a student working in a company, and I’ve been assigned to handle the deployment of OpenIAM on my own. I must admit I’m struggling a bit.

How did you find which functions, classes, and attributes to call (for example, StringOperationalConnectorValue, etc.)? I saw that there used to be a way to add an OpenIAM package to Eclipse, but it seems it’s no longer available — or at least I can’t manage to find it.

1 Like