本文整理汇总了PHP中CRM_Contact_BAO_Contact_Permission::cacheSubquery方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact_Permission::cacheSubquery方法的具体用法?PHP CRM_Contact_BAO_Contact_Permission::cacheSubquery怎么用?PHP CRM_Contact_BAO_Contact_Permission::cacheSubquery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Contact_Permission
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Contact_Permission::cacheSubquery方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSelectWhereClause
/**
* @inheritDoc
*/
public function addSelectWhereClause()
{
// We always return an array with these keys, even if they are empty,
// because this tells the query builder that we have considered these fields for acls
$clauses = array('id' => (array) CRM_Contact_BAO_Contact_Permission::cacheSubquery(), 'is_deleted' => CRM_Core_Permission::check('access deleted contacts') ? array() : array('!= 1'));
CRM_Utils_Hook::selectWhereClause($this, $clauses);
return $clauses;
}
示例2: apiWhereClause
/**
* Generates a clause suitable for adding to WHERE or ON when doing an api.get for this entity
*
* @param string $tableAlias
* @return null|string
*/
public function apiWhereClause($tableAlias)
{
$fields = $this->fields();
$cidField = CRM_Utils_Array::value('contact_id', $fields);
if (CRM_Utils_Array::value('FKClassName', $cidField) == 'CRM_Contact_DAO_Contact') {
return CRM_Contact_BAO_Contact_Permission::cacheSubquery("`{$tableAlias}`.contact_id");
}
return NULL;
}
示例3: apiWhereClause
/**
* @inheritDoc
*/
public function apiWhereClause($tableAlias)
{
// Generate an acl clause for both contacts in the relationship
$clauses = array();
foreach (array('a', 'b') as $a) {
$clause = CRM_Contact_BAO_Contact_Permission::cacheSubquery("`{$tableAlias}`.contact_id_{$a}");
if ($clause !== NULL) {
$clauses[] = $clause;
}
}
return $clauses ? implode(' AND ', $clauses) : NULL;
}
示例4: apiWhereClause
/**
* @inheritDoc
*/
public function apiWhereClause($tableAlias)
{
return CRM_Contact_BAO_Contact_Permission::cacheSubquery("`{$tableAlias}`.id");
}
示例5: apiWhereClause
/**
* @inheritDoc
*/
public function apiWhereClause($tableAlias)
{
$clauses = array();
// Only case admins can view deleted cases
if (!CRM_Core_Permission::check('administer CiviCase')) {
$clauses[] = "`{$tableAlias}`.is_deleted = 0";
}
// Ensure the user has permission to view the case client
$contactClause = CRM_Contact_BAO_Contact_Permission::cacheSubquery('contact_id');
if ($contactClause !== NULL) {
$clauses[] = "`{$tableAlias}`.id IN (SELECT case_id FROM civicrm_case_contact WHERE {$contactClause})";
}
// The api gatekeeper ensures the user has at least "access all cases and activities"
// so if they do not have permission to see all cases we'll assume they can only access their own
if (!CRM_Core_Permission::check('access all cases and activities')) {
$user = (int) CRM_Core_Session::getLoggedInContactID();
$clauses[] = "`{$tableAlias}`.id IN (\n SELECT r.case_id FROM civicrm_relationship r, civicrm_case_contact cc WHERE r.is_active = 1 AND cc.case_id = r.case_id AND (\n (contact_id_a = cc.contact_id AND contact_id_b = {$user}) OR (contact_id_b = cc.contact_id AND contact_id_a = {$user})\n )\n )";
}
return $clauses ? implode(' AND ', $clauses) : NULL;
}