IBM Verify

IBM Verify

Join this online user group to communicate across Security product users and IBM experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Modification of code :/

    Posted 05/13/21 09:03 AM

    Hello,

    it's me again :D

    I've problem with code which I wrote, almost everything works fine, almost :D

    As you can see - first is users login creation (baseuid) and replace signs, then if this login exists in system, it should create login with _1 (uid = baseuid + "_" + inc; ) but this doesn't happened :/

    I tried many modifications of code and still the same, everytime I have the same login :/

    Any ideas why? Any clues how can I do this?

    var name = subject.getProperty("givenName")[0].toLowerCase(); name = name.replace(/\s/g,"_"); var surname = subject.getProperty("sn")[0].toLowerCase(); surname = surname.replace(/[-\s]/g,"_"); function genUid() { var baseuid = removeAccents(name + "_" + surname); var inc = 0; var uidTaken = true; var uid = baseuid; while (uidTaken) { if(inc > 0) { uid = baseuid + "_" + inc; } var account = (new AccountSearch()).searchByUidAndService(uid, "LDAP"); if (account!=null) { inc++; } else { uidTaken = false; } } return uid; } function removeAccents(strAccents) { var strAccents = strAccents.split(''); var strAccentsOut = new Array(); var strAccentsLen = strAccents.length; var accents = 'ÀÁÂÃÄÅĄàáâãäåąÒÓÔÕÕÖØòóôõöøÈÉÊËĘèéêëęðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŃńŠšŸÿýŽžŁłŻżŹźŚśĆć'; var accentsOut = "AAAAAAAaaaaaaaOOOOOOOooooooEEEEEeeeeeeCcDIIIIiiiiUUUUuuuuNnNnSsYyyZzLlZzZzSsCc"; for (var y = 0; y < strAccentsLen; y++) { if (accents.indexOf(strAccents[y]) != -1) { strAccentsOut[y] = accentsOut.substr(accents.indexOf(strAccents[y]), 1); } else strAccentsOut[y] = strAccents[y]; } strAccentsOut = strAccentsOut.join(''); return strAccentsOut; } return genUid();

    #Support
    #SupportMigration
    #Verify


  • 2.  RE: Modification of code :/

    Posted 05/13/21 11:43 AM

    Hi Artur !

    Just to make it clear - I am not going to debug your script for you (that would be payable work) - so this is more a general advice on how to find the error in your script (and I assume this is an Identity Policy script - alternatively provisioning Policy script for eruid but that would be bad practice).

    You can insert Enrole.log() (or the newer statements logInfo() https://www.ibm.com/docs/hr/sim/7.0.1?topic=reference-enrole) in the code so that you can follow the progress - this is the standard way most ISIM people does it .

    Your check/increment is actually available in the identityPolicy script context as e.g. IdentityPolicy.userIDExists() https://www.ibm.com/docs/hr/sim/7.0.1?topic=reference-identitypolicy so I would recommend using that.

    If this is a provisioning policy script I would clearly recommend to move that to the identity policy - this is much more efficient and you do not have to redo the whole exercise as the value of the eruid for the account is available to the provisioning policies as parameters.eruid[0] https://www.ibm.com/docs/pt/sim/7.0.2?topic=parameters-provisioning-policy-javascript-functions

    HTH

    Regards

    Franz Wolfhagen



    #Support
    #SupportMigration
    #Verify