Hi,
I bought a plugin to add users directly from Active Directory. I want to be able to extract information from AD to osticket.

`
if (TRUE === ldap_bind($ldap_connection, $foo['bind_dn'], $pw)) {
$search_filter = '(&(objectCategory=person)(samaccountname=*)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))';
$attributes = array();
$attributes[] = 'displayname';
$attributes[] = 'mail';
$attributes[] = 'samaccountname';
$attributes[] = 'sn';
$attributes[] = 'telephonenumber';
$attributes[] = 'otherTelephone';
$attributes[] = 'department';
$attributes[] = 'title';
$attributes[] = 'employeeid';
$attributes[] = 'office';

// headers for import
$import = "email,name,phone,notes,department,employeeid,title,office\r\n";

$import .= $entries[$x]['mail'][0].','.$entries[$x]['displayname'][0].','.$entries[$x]['telephonenumber'][0].'X'.$entries[$x]['othertelephone'][0].','.$entries[$x]['department'][0].','.$entries[$x]['title'][0].','.$entries[$x]['employeeid'][0].','.$entries[$x]['office'][0].",\r\n";
// use the osTicket internal importer
$success = User::importCsv($import);`

This is the code I think I have to change, any advice will be appreciated.

That looks like the code that handles attribute selection from AD, and makes an import string to pass off to the importCSV function.

The only problem I see is the office attribute doesn't exist. In AD this is called physicalDeliveryOfficeName.

These might help
https://docs.classic.secureauth.com/display/KBA/Active+Directory+Attributes+List
https://docs.microsoft.com/en-us/windows/win32/adschema/attributes-all

Updated to add:
You would need to make sure that you add the these fields to the Contact Information form, and I am not sure that the importer will let you import them by their name, but it might.

So I was playing around and got this to work.

You need to go to Admin panel -> Manage -> Forms
Click on the Contact Information form
You add the additional fields that you want to sync. It is important that you add the variable name also.

example
If you want to sync the title attribute

in the adsync code you would add the AD attribute to the array.
$attributes[] = 'title';

Then you would add the field to the import array in two places.

  1. the headers $import = "email,name,phone,notes,title\r\n";
  2. and at the end of the $import .= line. '.$entries[$x]['title'][0]."\r\n";

You would do this for each additional attribute that you want to sync.

    ntozier In which form did you add it? I am using the Contact Information Form or Do I have to create a custom form?

    the header $import = "email,name,phone,notes,department,employeeid,title,office\r\n";
    the import $import .= $entries[$x]['mail'][0].','.$entries[$x]['displayname'][0].','.$entries[$x]['telephonenumber'][0].'X'.$entries[$x]['othertelephone'][0].','.$entries[$x]['department'][0].','.$entries[$x]['title'][0].','.$entries[$x]['employeeid'][0].','.$entries[$x]['office'][0]."\r\n";

    Is this correct?

    Sorry I wasn't clear in my post. I went back and edited it to make it more clear.
    The Admin panel -> Manage -> Forms: Contact information form.
    and make sure that these:
    email,name,phone,notes,department,employeeid,title,office
    match the variable names that you put into the Contact Information form.

    Two things look wrong to me.

    1. you do not have notes in the .=.
      after '.$entries[$x]['telephonenumber'][0].'X'.$entries[$x]['othertelephone'][0].' should be the notes field.
      So you should have two commas. This means that the notes will be empty.
      Alternatively, you could add something there to add to the account like "synced by adsync".

    2. there is still not office attribute in AD, so
      '.$entries[$x]['office'][0]."\r\n"; should be physicalDeliveryOfficeName
      '.$entries[$x]['physicalDeliveryOfficeName'][0]."\r\n";

    The whole line there should read something like:
    $import .= $entries[$x]['mail'][0].','.$entries[$x]['displayname'][0].','.$entries[$x]['telephonenumber'][0].'X'.$entries[$x]['othertelephone'][0].','synced by adSync','.$entries[$x]['department'][0].','.$entries[$x]['title'][0].','.$entries[$x]['employeeid'][0].','.$entries[$x]['physicalDeliveryOfficeName'][0]."\r\n";

    @scottro you might want to take a look at this for adding this to your adSync plugin. 🙂

    19 days later

    Was this the AD-Sync from software-mods? I only asked because I purchased the plugin last Wednesday 6/23 after opening a ticket on the site and asking if the plugin worked with OST 1.15.2 and getting the response that it does. I made my purchase shortly after, however I have not received a link to download the plugin. I did try to open another ticket but my password appears to be bad and there is no option to reset it. I am hoping this plugin is still available and the issue of getting the download link is a fluke.

    Respectfully,

    Thank you

    @itman0806

    Yes, we are talking about modding the 3rd party plugin.

    If you have an issue with your purchase from a 3rd party then you would want to reach out to the 3rd party. Their email and ticket system are on the front page of their webpage.

      ntozier

      Thank you for confirming. I have contacted them through their site and have only received one response and that was before my purchase. I have sent additional messages too. I'm sure it is a glitch of some sort. I'm hoping they also watch these forums.

      Thanks again for the quick response and I am glad to see the plugin is alive and well.

      Write a Reply...