本文整理匯總了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;
}