Пример #1
0
 public function run()
 {
     $adminUser = Config::get('ravel::app.setup_user');
     $adminGroup = Usergroup::orderBy('id', 'asc')->first();
     $adminUser['usergroup_id'] = (int) $adminGroup->id;
     DB::table('users')->delete();
     $user = new Usermodel();
     $user->fill($adminUser);
     $user->activated = true;
     $user->api_token = makeApiKey();
     $user->save();
 }
Пример #2
0
 /**
  * Logged in action, get's the session, current user,
  * those the user follow and activity
  * @param String $accessToken
  * @return View showLoggedIn
  */
 public function loggedInUser($accessToken)
 {
     $user = $this->model->getLoggedInUser($accessToken);
     $session = new Session();
     // If we can't find the user, just destroy it.
     if ($user === null) {
         $session->destroy($this->token);
         return;
     }
     $auth = $session->get($this->token);
     $followers = $this->followers->getFollowers($user->getLogin());
     $events = null;
     // Get events
     if ($followers !== null) {
         foreach ($followers as $follower) {
             $events[] = $this->model->getUserActivity($follower["user"]);
         }
     }
     $context = array($this->view->getFollowersField() => $followers, $this->view->getUserField() => $user, $this->view->getEventField() => $events, $this->view->getAuthField() => $auth, $this->view->getSearchField() => $this->search->getSearchFieldName());
     return $this->view->showLoggedIn($context);
 }
Пример #3
0
 /**
  * Action for start unfollowing a given user
  * @param String $user 
  * @return Create Follower View
  */
 public function unFollow($user)
 {
     $session = new Session();
     $accessToken = $session->get($this->auth->getTokenSessionName());
     if ($accessToken !== null) {
         $owner = $this->model->getLoggedInUser($accessToken)->getLogin();
         $successMsg = $this->view->getSuccessMessage();
         $errorMsg = $this->view->getErrorMessage();
         if ($this->followers->removeFollower($owner, $user)) {
             $context = array($successMsg => "You no longer follow " . $user);
         } else {
             $context = array($errorMsg => "You do not follow " . $user . " so you cannot unfollow");
         }
         return $this->view->createFollower($context);
     }
     return $this->errorView->showPageNotFound("/unfollow/" . $user);
 }
Пример #4
0
 public function __construct(\Doctrine\ORM\EntityManager $em, \Application\Service\Security $cs = null)
 {
     parent::__construct($em);
     $this->cs = $cs;
 }