Skip to content

Commit

Permalink
Leaf 4631 - update domain formatting on save
Browse files Browse the repository at this point in the history
  • Loading branch information
jampaul3 committed Jan 7, 2025
1 parent 7672c14 commit 4f69b76
Showing 1 changed file with 63 additions and 1 deletion.
64 changes: 63 additions & 1 deletion app/Leaf/VAMCActiveDirectory.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function importADData(string $file): string
$this->users[$id]['loginName'] = $employee['loginName'];
$this->users[$id]['objectGUID'] = null;
$this->users[$id]['mobile'] = $employee['mobile'];
$this->users[$id]['domain'] = $employee['domain'];
$this->users[$id]['domain'] = $this->parseVAdomain($employee['domain']);
$this->users[$id]['source'] = 'ad';
//echo "Grabbing data for $employee['lname'], $employee['fname']\n";
$count++;
Expand Down Expand Up @@ -394,4 +394,66 @@ private function fixIfHex(string $stringToFix): string

return $stringToFix;
}

private function parseVAdomain($adPath) {
$dc = '';
$dcSrc = explode(',', $adPath);
foreach($dcSrc as $adElement) {
if(strpos($adElement, 'DC=') !== false) {
$dc .= substr($adElement, 3) . '.';
}
}
$dc = trim($dc, '.');

switch($dc) {
case 'v01.med.va.gov':
return 'VHA01';
case 'v02.med.va.gov':
return 'VHA02';
case 'v03.med.va.gov':
return 'VHA03';
case 'v04.med.va.gov':
return 'VHA04';
case 'v05.med.va.gov':
return 'VHA05';
case 'v06.med.va.gov':
return 'VHA06';
case 'v07.med.va.gov':
return 'VHA07';
case 'v08.med.va.gov':
return 'VHA08';
case 'v09.med.va.gov':
return 'VHA09';
case 'v10.med.va.gov':
return 'VHA10';
case 'v11.med.va.gov':
return 'VHA11';
case 'v12.med.va.gov':
return 'VHA12';
case 'v13.med.va.gov':
return 'VHA13';
case 'v14.med.va.gov':
return 'VHA14';
case 'v15.med.va.gov':
return 'VHA15';
case 'v16.med.va.gov':
return 'VHA16';
case 'v17.med.va.gov':
return 'VHA17';
case 'v18.med.va.gov':
return 'VHA18';
case 'v19.med.va.gov':
return 'VHA19';
case 'v20.med.va.gov':
return 'VHA20';
case 'v21.med.va.gov':
return 'VHA21';
case 'v22.med.va.gov':
return 'VHA22';
case 'v23.med.va.gov':
return 'VHA23';
default:
return $dc;
}
}
}

0 comments on commit 4f69b76

Please sign in to comment.