Esempio n. 1
0
 public function isVisible()
 {
     try {
         ACLUser::checkCurrentUserGrants($this->rights);
     } catch (Exception $e) {
         return false;
     }
 }
Esempio n. 2
0
 public function isVisible()
 {
     try {
         ACLUser::checkCurrentUserGrants($this->rights->getValue());
         return true;
     } catch (\Exception $e) {
         return false;
     }
 }
Esempio n. 3
0
 /**
  * @param $document
  */
 public static function isEditable($modelName)
 {
     $permissionName = self::getPermissionName($modelName);
     try {
         if (!empty($permissionName)) {
             ACLUser::checkCurrentUserGrants(array($permissionName));
         }
         return true;
     } catch (Exception $e) {
         return false;
     }
 }
Esempio n. 4
0
 protected function checkACL()
 {
     if (!empty($this->requiredACLRights)) {
         try {
             ACLUser::checkCurrentUserGrants($this->requiredACLRights);
         } catch (Exception $e) {
             $errorMsg = sprintf('Failed to execute operation:%s. Current user - ', self::MethodName, UsersLogin::isLogined() ? sprintf('%s:%d', UsersLogin::getCurrentSession()->login->getValue(), UsersLogin::getCurrentSession()->id->getValue()) : '');
             Record::add('api', $errorMsg);
             throw $e;
         }
     }
 }
Esempio n. 5
0
 protected function searchSitemap()
 {
     try {
         ACLUser::checkCurrentUserGrants([SitemapModel::PermissionName]);
         $items = \Sitemap_Sample::search($this->searchPhrase, 0, 10);
     } catch (\Exception $e) {
         $items = [];
     }
     foreach ($items as $row) {
         $isScript = !empty($row['script_admin_url']);
         $add = new SearchResultModel();
         $add->title = $row['name'];
         $add->icon = 'glyphicon glyphicon-user';
         //
         if (!$isScript) {
             $route = CMS::getInstance()->getDispatcher()->getNamed('dashboard.sitemap.manage');
             $add->link = $route->buildUrl() . '?id=' . $row['id'];
         } else {
             $add->link = sprintf('http://%s%s', CMS::getDashboardWWWRoot(), $row['script_admin_url']);
         }
         $this->results[] = $add;
     }
 }
Esempio n. 6
0
 public function process()
 {
     ACLUser::checkCurrentUserGrants($this->aclActionList);
     return parent::process();
 }