Use contact permissions for the fax contacts if value is true.

This commit is contained in:
FusionPBX 2022-02-18 14:08:14 -07:00 committed by GitHub
parent 39bd197437
commit bbf61c3950
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 21 deletions

View File

@ -943,28 +943,30 @@ if (!$included) {
$sql .= "and cp.phone_type_fax = 1 "; $sql .= "and cp.phone_type_fax = 1 ";
$sql .= "and cp.phone_number is not null "; $sql .= "and cp.phone_number is not null ";
$sql .= "and cp.phone_number <> '' "; $sql .= "and cp.phone_number <> '' ";
if (is_array($user_group_uuids) && @sizeof($user_group_uuids) != 0) { if ($_SESSION['contact']['permissions']['boolean'] == "true") {
//only show contacts assigned to current user's group(s) and those not assigned to any group if (is_array($user_group_uuids) && @sizeof($user_group_uuids) != 0) {
$sql .= "and ("; //only show contacts assigned to current user's group(s) and those not assigned to any group
$sql .= " c.contact_uuid in ( "; $sql .= "and (";
$sql .= " select contact_uuid from v_contact_groups "; $sql .= " c.contact_uuid in ( ";
$sql .= " where ("; $sql .= " select contact_uuid from v_contact_groups ";
foreach ($user_group_uuids as $index => $user_group_uuid) { $sql .= " where (";
$sql .= $or; foreach ($user_group_uuids as $index => $user_group_uuid) {
$sql .= " group_uuid = :group_uuid_".$index." "; $sql .= $or;
$parameters['group_uuid_'.$index] = $user_group_uuid; $sql .= " group_uuid = :group_uuid_".$index." ";
$or = " or "; $parameters['group_uuid_'.$index] = $user_group_uuid;
$or = " or ";
}
unset($user_group_uuids, $index, $user_group_uuid, $or);
$sql .= " ) ";
$sql .= " and domain_uuid = :domain_uuid ";
$sql .= " ) ";
$sql .= " or ";
$sql .= " c.contact_uuid not in ( ";
$sql .= " select contact_uuid from v_contact_groups ";
$sql .= " where domain_uuid = :domain_uuid ";
$sql .= " ) ";
$sql .= ") ";
} }
unset($user_group_uuids, $index, $user_group_uuid, $or);
$sql .= " ) ";
$sql .= " and domain_uuid = :domain_uuid ";
$sql .= " ) ";
$sql .= " or ";
$sql .= " c.contact_uuid not in ( ";
$sql .= " select contact_uuid from v_contact_groups ";
$sql .= " where domain_uuid = :domain_uuid ";
$sql .= " ) ";
$sql .= ") ";
} }
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database; $database = new database;