Menu

Silly question about the LookupTable class in the collector...

schirrms
2023-03-23
2023-04-05
  • schirrms

    schirrms - 2023-03-23

    Hi,

    I hope some 'collector expert' is in this area...

    I'm trying to use the collecter (instead of my numerous perl scripts) to extend the ldap-collector. Now, I'm in a situation where I need some data already in iTop to establish correct links between Users and Teams.

    That's the whole point of the LookupTable class. But (there's ever a but...). In my case, I wish to realize a transformation in a list (so, in a kind of 'subarray', in a sense). I believe this is not possible with the 'Lookup' function ?

    If not, can I just call the constructor, and then dig in the object that the constructor build ? And if yes, how should I call the constructor to be sure to have this object before the run of the 'Prepare' function ?

    Thanks,

    Pascal

     
  • schirrms

    schirrms - 2023-03-27

    Well, wanted to reach my goal another way, but I'm stuck (a little further :))

    So, I started to use a basically unchanged version of ldap-collector to gather the Person.

    Then, I added a new subbclass to this collector, named 'iTopTeamLDAPCollector' who gather all groups with an email address and create Team in iTop.

    I also added a field named 'DN' in iTop, so, for each Person or Team, I also have the DN.

    Now, I would create another subclass for create link between Person and Team. This could be easier than trying to add the link in the 'persons_list' field of the team (and probably safer, because some of our lists are huge, and I think that the persons_list field would be too small)

    But, to build this subclass, I don't need a general LDAP search. Instead, I have built (more exactly, ChatGPT built for me :)) a nice function who returns for each group DN the appropriate list of group member.

    That's something I'm used to use in my own sync, but I don't really see how to do that with the Combodo collector ?

    What I exactly need is that :

    1. Query the list of Teams in iTop with a DN ==> LookupTable
    2. For each DN, start my chatgpt function with the DN of the Team (this function does LDAP query, so I need to connect to the LDAP server)
    3. Build my list of link between Person and Team
    4. Sync this list with iTop

    It should be easy, but I'm lost.

    Thanks,

    Pascal

     
  • Guillaume Lajarige

    Hello Pascal,

    I'm not very familiar with the collectors, but maybe @xtophe38 has an idea.

    Cheers,
    Guillaume

     
  • schirrms

    schirrms - 2023-04-05

    Hi Guillaume and all,

    In between, I was able to solve "my" LDAP collector :) So this query can now be closed.

    Basically, I added a third collector, and this one build the link between Teams and Persons. My only drawback is that, in this collector, I have to do the same two LDAP queries (To Ldap user and Ldap group), but, seeing the number of further queries I have to do to be able to "flatten" the 'group in group in group" thing, I do think that these few initial queries are harmless.

    Thanks,

    Pascal

     
  • Guillaume Lajarige

    Thanks for the feedback Pascal! Glad to see that you found a way to make it work :)

    Guillaume

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.