Exemplo n.º 1
0
 /**
  * Login user
  *
  * @param integer $userId
  * @param string $nickName
  * @param boolean $rememberMe
  * @return void
  */
 public static function loginUser($userId, $nickName, $rememberMe)
 {
     $user = [];
     $user['user_id'] = $userId;
     // save user id
     UserIdentityService::getAuthService()->getStorage()->write($user);
     UserIdentityService::setCurrentUserIdentity(UserIdentityService::getUserInfo($userId));
     AclService::clearCurrentAcl();
     // fire the user login event
     UserEvent::fireLoginEvent($userId, $nickName);
     if ($rememberMe) {
         ServiceLocatorService::getServiceLocator()->get('Zend\\Session\\SessionManager')->rememberMe((int) SettingService::getSetting('user_session_time'));
     }
 }