Example #1
0
 /**
  *	Shared
  *	@return \Touchbase\Data\Store
  */
 public static function shared()
 {
     $store = Session::get(self::STORE_SESSION_KEY, new Store());
     if (!$store->count()) {
         Session::set(self::STORE_SESSION_KEY, $store);
     }
     return $store;
 }
Example #2
0
 /**
  *	Current User
  *	@return \Touchbase\Security\Auth\AuthedUserInterface
  */
 public static function currentUser()
 {
     if (!($currentUserCookie = self::shared()->retrieveUserFromCookie())) {
         return null;
     }
     $currentUser = Session::get(self::AUTH_SESSION_KEY);
     if (!$currentUser || $currentUser->ID() != $currentUserCookie->ID()) {
         return null;
     }
     return $currentUser;
 }