do not show others extension to non-admin users

This commit is contained in:
luis daniel lucio quiroz
2015-02-27 15:25:49 +00:00
parent a327901cb8
commit 455f0b2e45
2 changed files with 42 additions and 3 deletions
+20 -1
View File
@@ -22,6 +22,7 @@
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/
require_once "root.php";
@@ -61,6 +62,24 @@ require_once "resources/require.php";
$sql .= "where ";
$sql .= "enabled = 'true' ";
$sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' ";
if (!(if_group("admin") || if_group("superadmin"))) {
if (count($_SESSION['user']['extension']) > 0) {
$sql .= "and (";
$x = 0;
foreach($_SESSION['user']['extension'] as $row) {
if ($x > 0) { $sql .= "or "; }
$sql .= "extension = '".$row['user']."' ";
$x++;
}
$sql .= ")";
}
else {
//used to hide any results when a user has not been assigned an extension
$sql .= "and extension = 'disabled' ";
}
}
$sql .= "order by ";
$sql .= "extension asc";
$prep_statement = $db->prepare(check_sql($sql));
@@ -315,4 +334,4 @@ require_once "resources/require.php";
//show the footer
require_once "resources/footer.php";
?>
?>