From 197948aa4a53a7ff32b98323253238195d2257f6 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Wed, 30 Jun 2021 13:01:33 -0600 Subject: [PATCH] Add new permission contact_domain_view --- app/contacts/app_config.php | 4 ++++ app/contacts/contacts.php | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/contacts/app_config.php b/app/contacts/app_config.php index be602c3f1e..c3294676e5 100644 --- a/app/contacts/app_config.php +++ b/app/contacts/app_config.php @@ -52,6 +52,10 @@ $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; $y++; + $apps[$x]['permissions'][$y]['name'] = "contact_domain_view"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['groups'][] = "admin"; + $y++; $apps[$x]['permissions'][$y]['name'] = "contact_address_view"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; diff --git a/app/contacts/contacts.php b/app/contacts/contacts.php index 3e55872cd0..65f19dc2d3 100644 --- a/app/contacts/contacts.php +++ b/app/contacts/contacts.php @@ -86,7 +86,7 @@ $sql .= "and contact_setting_name = 'array' "; $sql .= "and contact_setting_value <> '' "; $sql .= "and contact_setting_value is not null "; - if (!(if_group("superadmin") || if_group("admin"))) { + if (permission_exists('contact_domain_view') { $sql .= "and ( "; //only contacts assigned to current user's group(s) and those not assigned to any group $sql .= " contact_uuid in ( "; $sql .= " select contact_uuid from v_contact_groups "; @@ -187,7 +187,7 @@ $sql = "select count(*) "; $sql .= "from v_contacts as c "; $sql .= "where domain_uuid = :domain_uuid "; - if (!(if_group("superadmin") || if_group("admin"))) { + if (permission_exists('contact_domain_view') { $sql .= "and ( "; //only contacts assigned to current user's group(s) and those not assigned to any group $sql .= " contact_uuid in ( "; $sql .= " select contact_uuid from v_contact_groups "; @@ -395,4 +395,4 @@ //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?>