コード例 #1
0
ファイル: Issue.php プロジェクト: Roave/issues
 protected function _addAclJoins(Zend_Db_Select $sql, $alias = null, $primaryKey = null)
 {
     if (Zend_Registry::get('Default_DiContainer')->getAclService()->isAllowed('issue', 'view-all')) {
         return $sql;
     }
     $sql = parent::_addAclJoins($sql, $alias, $primaryKey);
     if ($alias === null) {
         $alias = $this->getTableName();
     }
     $table = $this->getTableName();
     if ($primaryKey === null) {
         $primaryKey = $table . '_id';
     }
     $roles = Zend_Registry::get('Default_DiContainer')->getUserService()->getIdentity()->getRoles();
     $sql->join(array('p' => 'project'), "p.project_id = {$alias}.project", array())->joinLeft(array('p_arr' => 'acl_resource_record'), "`p_arr`.`resource_type` = 'project' AND `p_arr`.`resource_id` = `{$alias}`.`project`", array())->where('((p.private = ?', 1)->where('p_arr.role_id IN (?))', $roles)->orWhere('p.private = ?)', 0);
     return $sql;
 }