The CreatorCon Call for Content is officially open! Get started here.

where to find GlideLDAPGroups

User370547
Giga Contributor

Hello

We are importing  users and groups from ldap.   But for some reason the SN ldap group is not populated with users.

I have debugged "LDAPUtils"  and can see that:  var group = new GlideLDAPGroups(target, geString);

is called with the correct values.   

target -  the object from sys_user_group
geString - a string with one or more usernames

I could not find "GlideLDAPGroups"  to get deeper.   It's not a script include !?

Where can I find "GlideLDAPGroups" ?

Sincerely Detlef Biedermann

 

7 REPLIES 7

User370547
Giga Contributor
Many thanks. 
 
So I have changed to:
#####################################################################################
 
var v_gr = new GlideRecord("sys_user_group");
v_gr.get("031b08892fd020109da8532a2799b6a7");   // get object 'ldap_group_itil';

gs.info(v_gr.name);

var geString = 'uid=ldap_itil,ou=people,dc=pitcom,dc=com';    // set user 'ldap_itil'

var group = new GlideLDAPGroups(v_gr, geString);
group.setMembers();

#####################################################################################

 
 
*** Script: ldap_group_itil LDAP API - LDAPGroups : Updating membership of group for members : [uid=ldap_itil,ou=people,dc=pitcom,dc=com] LDAP API - LDAPGroups : User with DN : uid=ldap_itil,ou=people,dc=pitcom,dc=commapped to id : null

 
 
 
Ldap Server: Start Search Directory:  dc=pitcom,dc=com
 
How should the user record look like, that the user will be found.   (where is   "uid=ldap_itil,ou=people,dc=pitcom,dc=com"  saved ?)
 

Sincerely Detlef

so if the source field looks like this:

find_real_file.png

Then the code would be:

 

var v_gr = new GlideRecord("sys_user_group");
v_gr.get("031b08892fd020109da8532a2799b6a7");   // get object 'ldap_group_itil';

gs.info(v_gr.name);

var geString = 'KuntaKinta';    // set user 'ldap_itil'

var group = new GlideLDAPGroups(v_gr, geString);
group.setMembers();

So the value in the source field needs to start with ldap: and then the value that comes after : is the value that needs to be in the string that is used in the code.

Does that make sense?

martinLP86
Tera Contributor

Hi Goran, thank you for the info. I was trying to use the setMembers() method. What it does is all users are deleted and, then it inserts the one I added in the function.

Is there any addmember() method?

Thank you!