Esempio n. 1
0
 /**
  * @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;
     }
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
 /**
  * Whether the user has the 'managePages' role.
  *
  * @return bool
  */
 protected function managesPages()
 {
     return Gate::allows('managePages', Router::getActiveSite()) === true;
 }