Пример #1
0
 /**
  * @param int $access_flag
  * @param User $mTargetUser
  */
 private function apply($access_flag, $mTargetUser)
 {
     if ($this->context_company->isEmpty()) {
         throw new NotFoundCompanyException();
     }
     if ($access_flag == 2) {
         throw new UserAccessDeniedException();
     }
     $mAccessManager = new UserAccessManager();
     $tempUserFields = array();
     if ($mAccessManager->can($access_flag, 'id')) {
         $tempUserFields['id'] = intval($mTargetUser->getId());
     }
     if ($mAccessManager->can($access_flag, 'email')) {
         $tempUserFields['email'] = $mTargetUser->getEmail();
     }
     if ($mAccessManager->can($access_flag, 'first_name')) {
         $tempUserFields['first_name'] = $mTargetUser->getFirstName();
     }
     if ($mAccessManager->can($access_flag, 'last_name')) {
         $tempUserFields['last_name'] = $mTargetUser->getLastName();
     }
     if ($mAccessManager->can($access_flag, 'patronymic')) {
         $tempUserFields['patronymic'] = $mTargetUser->getPatronymicName();
     }
     if ($mAccessManager->can($access_flag, 'photo')) {
         $tempUserFields['photo'] = $mTargetUser->getPhoto();
     }
     if ($mAccessManager->can($access_flag, 'phone')) {
         $tempUserFields['phone'] = $mTargetUser->getPhone();
     }
     if ($mAccessManager->can($access_flag, 'register_time')) {
         $tempUserFields['register_time'] = intval($mTargetUser->getRegisterTime());
     }
     if ($mAccessManager->can($access_flag, 'last_logged_time')) {
         $tempUserFields['last_logged_time'] = intval($mTargetUser->getLastLoggedTime());
     }
     if ($mAccessManager->can($access_flag, 'company_id')) {
         $tempUserFields['company_id'] = intval($mTargetUser->getCompanyId());
     }
     if ($mAccessManager->can($access_flag, 'access_flag')) {
         $tempUserFields['access_flag'] = intval($mTargetUser->getAccessFlag());
     }
     if ($mAccessManager->can($access_flag, 'access_flag')) {
         $tempUserFields['user_group'] = $mTargetUser->getUserGroupKey();
     }
     if ($mAccessManager->can($access_flag, 'sms_notify')) {
         $tempUserFields['sms_notify'] = $mTargetUser->isSmsNotificationEnabled();
     }
     if ($mAccessManager->can($access_flag, 'recent_activity_time')) {
         $tempUserFields['recent_activity_time'] = intval($mTargetUser->getRecentActivityTime());
     }
     $this->result = $tempUserFields;
 }