Просмотр исходного кода

Add office loacation to new user as entity #57 (#58)

Co-authored-by: Michel Victor <mvictor@oei.es>
Michel Victor 2 лет назад
Родитель
Сommit
416939b91c
1 измененных файлов с 11 добавлено и 0 удалено
  1. 11 0
      inc/provider.class.php

+ 11 - 0
inc/provider.class.php

@@ -1251,6 +1251,17 @@ class PluginSinglesignonProvider extends CommonDBTM {
                'is_active' => 1
             ];
 
+            // Set the office location from Office 365 user as entity for the GLPI new user if they names match
+            if (isset($resource_array['officeLocation'])) {
+               global $DB;
+               foreach ($DB->request('glpi_entities') as $entity) {
+                  if ($entity['name'] == $resource_array['officeLocation']) {
+                     $userPost['entities_id'] = $entity['id'];
+                     break;
+                  }
+               }
+            }
+
             if ($email) {
                $userPost['_useremails'][-1] = $email;
             }