/** * Log logout activity * * @param $userId */ public function logout($userId) { $userActivity = new UserActivity(); $userActivity->userId = $userId; $userActivity->type = "logout"; $this->userActivityRepository->save($userActivity); }
/** * Create User Entity from adUser * * @param Models\User $adUser * * @return null|user */ protected function createUserFromAd(Models\User $adUser) { $user = new User(); $user->fullName = $adUser->getDisplayName(); $user->userName = $adUser->getAccountName(); $user->email = $adUser->getEmail(); $user->phone = $adUser->getTelephoneNumber(); $user->title = $adUser->getTitle(); $user->thumbnail = $adUser->getThumbnailEncoded(); // save user if ($this->userRepository->save($user)) { $userActivity = new UserActivity(); $userActivity->userId = $user->id; $userActivity->type = "createFromAuthDriver"; $userActivity->description = "Auto create from " . $this->getName(); $this->userActivityRepository->save($userActivity); } else { $user = null; } return $user; }