コード例 #1
0
ファイル: API.obj.php プロジェクト: jrgns/backend-php
 public function action_check_defines()
 {
     if (!Component::isActive('BackendError')) {
         return false;
     }
     $query = new SelectQuery('BackendError');
     $query->distinct()->field('query')->filter("`string` LIKE 'Undefined index: %'")->filter("`file` LIKE '%\\\\Render.obj.php(%) : eval()\\'d code'")->filter("`query` LIKE 'a_p_i/define/%'");
     return $query->fetchAll(array(), array('column' => 0));
 }
コード例 #2
0
 public function read($options = array())
 {
     $result = parent::read($options);
     if ($result) {
         $query = new SelectQuery('Assignment');
         $query->distinct()->field('`roles`.`name`')->leftJoin('Role', '`roles`.`id` = `assignments`.`role_id`')->filter("`assignments`.`access_type` = 'users'")->filter('`assignments`.`access_id` = :user_id OR `assignments`.`access_id` = 0')->order('`roles`.`name`');
         $roles = $query->fetchAll(array(':user_id' => $this->getMeta('id')), array('column' => 0));
         $roles = empty($roles) ? array() : $roles;
         if ($this->object) {
             $this->object->roles = $roles;
         }
         if ($this->array) {
             $this->array['roles'] = $roles;
         }
     }
     return $result;
 }
コード例 #3
0
ファイル: GateManager.obj.php プロジェクト: jrgns/backend-php
 public function get_permissions($component = false)
 {
     $toret = new stdClass();
     //Base Permissions
     $parameters = array();
     $query = new SelectQuery('Permission');
     $query->distinct()->field(array('action', 'subject'))->filter('`active` = 1')->filter('`subject_id` = 0')->group('`subject`, `action` WITH ROLLUP');
     if ($component) {
         $query->filter('`subject` = :component');
         $parameters[':component'] = class_for_url($component);
     }
     $toret->base_perms = $query->fetchAll($parameters);
     //Roles
     $query = new SelectQuery('Role');
     $query->filter('`active` = 1');
     $toret->roles = $query->fetchAll();
     //Activated Permissions
     $parameters = array();
     $query = new SelectQuery('Permission', array('fields' => "CONCAT(`subject`, '::', `action`), GROUP_CONCAT(DISTINCT `role` ORDER BY `role`) AS `roles`"));
     $query->filter('`active` = 1')->filter('`subject_id` = 0')->filter("`role` != 'nobody'")->group('`subject`, `action`');
     if ($component) {
         $query->filter('`subject` = :component');
         $parameters[':component'] = class_for_url($component);
     }
     $permissions = $query->fetchAll($parameters, array('with_key' => 1));
     $toret->permissions = array();
     foreach ($permissions as $key => $value) {
         $toret->permissions[$key] = explode(',', current($value));
     }
     return $toret;
 }
コード例 #4
0
 /**
  * @return SelectQuery
  **/
 public function fillSelectQuery(SelectQuery $query)
 {
     $query->limit($this->limit, $this->offset);
     if ($this->distinct) {
         $query->distinct();
     }
     if ($this->logic->getSize()) {
         $query->andWhere($this->logic->toMapped($this->checkAndGetDao(), $query));
     }
     if ($this->order) {
         $query->setOrderChain($this->order->toMapped($this->checkAndGetDao(), $query));
     }
     if ($this->projection->isEmpty() && $this->strategy->getId() != FetchStrategy::CASCADE) {
         $this->joinProperties($query, $this->checkAndGetDao(), $this->checkAndGetDao()->getTable(), true);
     }
     return $query;
 }