/**
* @inheritDoc
*/
- public function apiWhereClause() {
+ public function addSelectWhereClause() {
$clauses = array(
'id' => array(),
// Only case admins can view deleted cases
/**
* @inheritDoc
*/
- public function apiWhereClause() {
+ public function addSelectWhereClause() {
// In order to make things easier for downstream developers, we reuse and adapt case acls here.
// This doesn't yield the most straightforward query, but hopefully the sql engine will sort it out.
$clauses = array(
);
$caseSubclauses = array();
$caseBao = new CRM_Case_BAO_Case();
- foreach ($caseBao->apiWhereClause() as $field => $fieldClauses) {
+ foreach ($caseBao->addSelectWhereClause() as $field => $fieldClauses) {
if ($field == 'id' && $fieldClauses) {
$clauses['case_id'] = array_merge($clauses['case_id'], (array) $fieldClauses);
}
}
}
// Add acl clause
- $aclClauses = array_filter(CRM_Case_BAO_Case::getAclClause());
+ $aclClauses = array_filter(CRM_Case_BAO_Case::getSelectWhereClause());
foreach ($aclClauses as $clause) {
$query->_where[0][] = $clause;
}
/**
* @inheritDoc
*/
- public function apiWhereClause() {
+ public function addSelectWhereClause() {
$clauses = array(
'id' => CRM_Contact_BAO_Contact_Permission::cacheSubquery(),
);
/**
* @inheritDoc
*/
- public function apiWhereClause() {
+ public function addSelectWhereClause() {
// Generate an acl clause for both contacts in the relationship
$clauses = array(
'contact_id_a' => CRM_Contact_BAO_Contact_Permission::cacheSubquery(),
/**
* @inheritDoc
*/
- public function apiWhereClause() {
+ public function addSelectWhereClause() {
// Prevent default behavior of joining ACLs onto the contact_id field
$clauses = array();
CRM_Utils_Hook::selectWhereClause($this, $clauses);
}
/**
- * Generates clauses suitable for adding to WHERE or ON when doing an api.get for this entity
+ * Generates acl clauses suitable for adding to WHERE or ON when doing an api.get for this entity
*
* Return format is in the form of fieldname => clauses starting with an operator. e.g.:
* @code
*
* @return array
*/
- public function apiWhereClause() {
+ public function addSelectWhereClause() {
$clauses = array();
$fields = $this->fields();
$cidField = CRM_Utils_Array::value('contact_id', $fields);
* @param string $tableAlias
* @return array
*/
- public static function getAclClause($tableAlias = NULL) {
+ public static function getSelectWhereClause($tableAlias = NULL) {
$bao = new static();
if ($tableAlias === NULL) {
$tableAlias = $bao->tableName();
}
$clauses = array();
- foreach ((array) $bao->apiWhereClause() as $field => $vals) {
+ foreach ((array) $bao->addSelectWhereClause() as $field => $vals) {
$clauses[$field] = NULL;
if ($vals) {
$clauses[$field] = "`$tableAlias`.`$field` " . implode(" AND `$tableAlias`.`$field` ", (array) $vals);
// Contact-related data permissions.
// CRM-14094 - Users can edit and delete contact-related objects using inline edit with 'edit all contacts' permission
$permissions['address'] = array(
- // get is managed by BAO::apiWhereClause
+ // get is managed by BAO::addSelectWhereClause
'get' => array(),
'default' => array(
'access CiviCRM',
$permissions['phone'] = $permissions['address'];
$permissions['website'] = $permissions['address'];
$permissions['im'] = $permissions['address'];
- // @todo - implement CRM_Core_BAO_EntityTag::apiWhereClause and remove this heavy-handed restriction
+ // @todo - implement CRM_Core_BAO_EntityTag::addSelectWhereClause and remove this heavy-handed restriction
$permissions['entity_tag'] = array('get' => array('access CiviCRM', 'view all contacts')) + $permissions['address'];
// @todo - ditto
$permissions['note'] = $permissions['entity_tag'];
//relationship permissions
$permissions['relationship'] = array(
- // get is managed by BAO::apiWhereClause
+ // get is managed by BAO::addSelectWhereClause
'get' => array(),
'delete' => array(
'access CiviCRM',
'delete in CiviCase',
),
'default' => array(
- // This is the minimum permission needed. Finer-grained access is controlled by CRM_Case_BAO_Case::apiWhereClause
+ // This is the minimum permission needed. Finer-grained access is controlled by CRM_Case_BAO_Case::addSelectWhereClause
'access my cases and activities',
),
);
if (count($stack) === 1 && in_array($stack[0], $this->aclFields)) {
return NULL;
}
- $clauses = $baoName::getAclClause($tableAlias);
+ $clauses = $baoName::getSelectWhereClause($tableAlias);
if (!$stack) {
// Track field clauses added to the main entity
$this->aclFields = array_keys($clauses);