/** * Executed when this component is bound to a page or layout. */ public function onRun() { $this->appId = GraphAPI::instance()->appId; $this->redirectLogin = $this->property('redirectLogin') ? $this->controller->pageUrl($this->property('redirectLogin')) : URL::previous(); $this->redirectSignup = $this->property('redirectSignup') ? $this->controller->pageUrl($this->property('redirectSignup')) : URL::previous(); return parent::onRun(); }
/** * Executed when this component is bound to a page or layout. */ public function onRun() { $this->setProperty('security', self::ALLOW_USER); if ($redirect = parent::onRun()) { return $redirect; } /** @var $user User */ $user = $this->page['user']; $redirectUrl = $this->controller->pageUrl($this->property('redirect')); $allowedGroup = $this->property('group', null); $group = UserGroup::where('id', $allowedGroup); if (!$group || !$user->inGroup($group)) { return Redirect::guest($redirectUrl); } $this->page['group'] = $group; }