/** * @param Person $person * @param string $ability * * @return bool */ public function before(Person $person, $ability) { if ($person->isSuperUser()) { return true; } if (!$person->hasSite(Router::getActiveSite())) { return false; } }
public function __construct(array $params) { // Exclude invisible should be included by default // To prevent invisible pages showing up in the site to non CMS users. if (!isset($params['excludeinvisible'])) { $params['excludeinvisible'] = null; } // Always include the ACL filter. $params['acl'] = [Router::getActiveSite(), Auth::user()]; $this->params = $params; }
public static function items() { $items = Config::get('boomcms.menu'); foreach ($items as $key => $item) { if (isset($item['role']) && Gate::denies($item['role'], Router::getActiveSite())) { unset($items[$key]); continue; } $items[$key]['title'] = isset($item['title']) ? $item['title'] : Lang::get('boomcms::menu.' . $key); } usort($items, function ($a, $b) { if ($a['title'] === $b['title']) { return 0; } return $a['title'] < $b['title'] ? -1 : 1; }); return $items; }
/** * Whether the user has the 'managePages' role. * * @return bool */ protected function managesPages() { return Gate::allows('managePages', Router::getActiveSite()) === true; }