本文整理汇总了PHP中CRM_Contact_BAO_Contact_Permission::hasContactsInCache方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact_Permission::hasContactsInCache方法的具体用法?PHP CRM_Contact_BAO_Contact_Permission::hasContactsInCache怎么用?PHP CRM_Contact_BAO_Contact_Permission::hasContactsInCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Contact_Permission
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Contact_Permission::hasContactsInCache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: giveMeAllACLs
/**
* Validate user permission across
* edit or view or with supportable acls.
*
* return boolean true/false.
**/
static function giveMeAllACLs()
{
if (CRM_Core_Permission::check('view all contacts') || CRM_Core_Permission::check('edit all contacts')) {
return TRUE;
}
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
if (self::isMultisiteEnabled()) {
// For multisite just check if there are contacts in acl_contact_cache table for now.
// FixMe: so even if a user in multisite has very limited permission could still
// see search / contact navigation options for example.
return CRM_Contact_BAO_Contact_Permission::hasContactsInCache(CRM_Core_Permission::VIEW, $contactID);
}
//check for acl.
$aclPermission = self::getPermission();
if (in_array($aclPermission, array(CRM_Core_Permission::EDIT, CRM_Core_Permission::VIEW))) {
return TRUE;
}
// run acl where hook and see if the user is supplying an ACL clause
// that is not false
$tables = $whereTables = array();
$where = NULL;
CRM_Utils_Hook::aclWhereClause(CRM_Core_Permission::VIEW, $tables, $whereTables, $contactID, $where);
return empty($whereTables) ? FALSE : TRUE;
}