* @return array|null
*/
public static function entityTable() {
+ CRM_Core_Error::deprecatedFunctionWarning('unused function to be removed');
if (!self::$_entityTable) {
self::$_entityTable = [
'civicrm_contact' => ts('Contact'),
* @return array|null
*/
public static function objectTable() {
+ CRM_Core_Error::deprecatedFunctionWarning('unused function to be removed');
if (!self::$_objectTable) {
self::$_objectTable = [
'civicrm_contact' => ts('Contact'),
}
/**
- * @return array|null
+ * Available operations for pseudoconstant.
+ *
+ * @return array
*/
public static function operation() {
if (!self::$_operation) {
* @throws \CRM_Core_Exception
*/
public static function getClause($table, $id, &$tables) {
+ CRM_Core_Error::deprecatedFunctionWarning('unused function to be removed');
$table = CRM_Utils_Type::escape($table, 'String');
$id = CRM_Utils_Type::escape($id, 'Integer');
$whereTables = [];
*
* @throws \CRM_Core_Exception
*/
- public static function getACLs($contact_id = NULL) {
+ protected static function getACLs(int $contact_id) {
$results = [];
- if (empty($contact_id)) {
- return $results;
- }
-
- $contact_id = CRM_Utils_Type::escape($contact_id, 'Integer');
-
$rule = new CRM_ACL_BAO_ACL();
- $acl = self::getTableName();
$contact = CRM_Contact_BAO_Contact::getTableName();
- $c2g = CRM_Contact_BAO_GroupContact::getTableName();
- $group = CRM_Contact_BAO_Group::getTableName();
$query = " SELECT acl.*
- FROM $acl acl";
-
- if (!empty($contact_id)) {
- $query .= " WHERE acl.entity_table = '$contact'
- AND acl.entity_id = $contact_id";
- }
+ FROM civicrm_acl acl
+ WHERE acl.entity_table = '$contact'
+ AND acl.entity_id = $contact_id";
$rule->query($query);
*
* @throws \CRM_Core_Exception
*/
- public static function getACLRoles($contact_id = NULL) {
+ protected static function getACLRoles($contact_id = NULL) {
$contact_id = CRM_Utils_Type::escape($contact_id, 'Integer');
$rule = new CRM_ACL_BAO_ACL();
* Assoc array of ACL rules
* @throws \CRM_Core_Exception
*/
- public static function getGroupACLs($contact_id, $aclRoles = FALSE) {
+ protected static function getGroupACLs($contact_id, $aclRoles = FALSE) {
$contact_id = CRM_Utils_Type::escape($contact_id, 'Integer');
$rule = new CRM_ACL_BAO_ACL();
- $acl = self::getTableName();
$c2g = CRM_Contact_BAO_GroupContact::getTableName();
$group = CRM_Contact_BAO_Group::getTableName();
$results = [];
if ($contact_id) {
$query = "
SELECT acl.*
- FROM $acl acl
+ FROM civicrm_acl acl
INNER JOIN $c2g group_contact
ON acl.entity_id = group_contact.group_id
WHERE acl.entity_table = '$group'
* Array of assoc. arrays of ACL rules
* @throws \CRM_Core_Exception
*/
- public static function getGroupACLRoles($contact_id) {
+ protected static function getGroupACLRoles($contact_id) {
$contact_id = CRM_Utils_Type::escape($contact_id, 'Integer');
$rule = new CRM_ACL_BAO_ACL();
- $acl = self::getTableName();
$aclRole = 'civicrm_acl_role';
$aclER = CRM_ACL_DAO_EntityRole::getTableName();
$c2g = CRM_Contact_BAO_GroupContact::getTableName();
- $group = CRM_Contact_BAO_Group::getTableName();
$query = " SELECT acl.*
- FROM $acl acl
+ FROM civicrm_acl acl
INNER JOIN civicrm_option_group og
ON og.name = 'acl_role'
INNER JOIN civicrm_option_value ov
$query = "
SELECT acl.*
- FROM $acl acl
+ FROM civicrm_acl acl
WHERE acl.entity_id IN ( $roles )
AND acl.entity_table = 'civicrm_acl_role'
";
$result = [];
/* First, the contact-specific ACLs, including ACL Roles */
- $result += self::getACLs($contact_id);
+ if ($contact_id) {
+ $result += self::getACLs((int) $contact_id);
+ }
/* Then, all ACLs granted through group membership */
$result += self::getGroupACLs($contact_id, TRUE);
$params = [1 => [$str, 'String']];
$count = CRM_Core_DAO::singleValueQuery($query, $params);
- return ($count) ? TRUE : FALSE;
+ return (bool) $count;
}
/**
*
* @return bool
*/
- public static function matchType($type, $operation) {
+ protected static function matchType($type, $operation) {
$typeCheck = FALSE;
switch ($operation) {
case 'All':