private function Synchronize($username) { $registration = $this->GetRegistration(); $userGroups = $this->user->GetGroups(); $groupsToSync = null; if ($userGroups != null) { $lowercaseGroups = array_map('strtolower', $userGroups); $groupsToSync = array(); $groups = $this->GetGroupRepository()->GetList()->Results(); /** @var GroupItemView $group */ foreach ($groups as $group) { if (in_array(strtolower($group->Name()), $lowercaseGroups)) { Log::Debug('ActiveDirectory: Syncing group %s for user %s', $group->Name(), $username); $groupsToSync[] = new UserGroup($group->Id(), $group->Name()); } else { Log::Debug('ActiveDirectory: User %s is not part of group %s, sync skipped', $group->Name(), $username); } } } $registration->Synchronize(new AuthenticatedUser($username, $this->user->GetEmail(), $this->user->GetFirstName(), $this->user->GetLastName(), $this->password, Configuration::Instance()->GetKey(ConfigKeys::LANGUAGE), Configuration::Instance()->GetDefaultTimezone(), $this->user->GetPhone(), $this->user->GetInstitution(), $this->user->GetTitle(), $groupsToSync)); }
private function Synchronize($username) { $registration = $this->GetRegistration(); $registration->Synchronize(new AuthenticatedUser($username, $this->user->GetEmail(), $this->user->GetFirstName(), $this->user->GetLastName(), $this->password, Configuration::Instance()->GetKey(ConfigKeys::LANGUAGE), Configuration::Instance()->GetDefaultTimezone(), $this->user->GetPhone(), $this->user->GetInstitution(), $this->user->GetTitle())); }
public function testMapsUserAttributes() { $mapping = array('sn' => 'sn', 'givenname' => 'givenname', 'mail' => 'fooName'); $entry = new TestAdLdapEntry(); $entry->sn = 'sn'; $entry->givenname = 'given'; $entry->fooName = 'foo'; $entry->telephonenumber = 'phone'; $user = new ActiveDirectoryUser($entry, $mapping); $this->assertEquals('sn', $user->GetLastName()); $this->assertEquals('given', $user->GetFirstName()); $this->assertEquals('foo', $user->GetEmail()); $this->assertEquals('phone', $user->GetPhone()); }