public function before() { parent::before(); if ($this->game_id) { $game = ORM::factory('User_Game')->where('game_id', '=', $this->game_id)->where('user_id', '=', $this->user->id)->find(); if (!$game->loaded()) { $game = ORM::factory('User_Game')->create_game(array('game_id' => $this->game_id, 'user_id' => $this->user->id), array('game_id', 'user_id')); } $this->game = $game; } }
public function before() { $this->config = Kohana::$config->load('forum'); // Set forum to protected if we do not allow guests. // TODO: improve this check, database based depending on category? // Perhapse we should use policies? if ($this->protected === FALSE and $this->config['guest'] === FALSE) { $this->protected = TRUE; } parent::before(); // TODO: Check if user can view forum? }
public function before() { parent::before(); $permission = $this->request->controller() . '_' . $this->request->action(); }