Exemplo n.º 1
0
 /**
  * Starts session for admin user
  * @param int $user_id
  * @return string session id
  */
 public function startSession($user_id)
 {
     $this->deleteOldSessions();
     $user_id = (int) $user_id;
     $sid = $this->generateUserSid($user_id);
     $session = UsersSessionEntityRepository::findOneEntityByCriteria(['sid' => $sid, 'user_id' => $user_id]);
     if (!$session) {
         $session = new UsersSessionEntity();
     }
     $session->setSid($sid);
     $session->setUserId($user_id);
     $session->save();
     return $sid;
 }