Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
111 righe
4.6 KiB
111 righe
4.6 KiB
<? |
|
|
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$error = true; |
|
if (isset($_SESSION["utente"]) && !empty($_GET["sezione"]) && !empty($_GET["codice_elemento"]) && $_SESSION["utente"]->permission($_GET["sezione"],$_GET["codice_elemento"])) { |
|
$utenti = ente::getUtentiFromModulo($_GET["sezione"],$_SESSION["ente"]->codice); |
|
$error = false; |
|
?> |
|
<div class="alert alert-warning text-center"> |
|
<span class="fa fa-exclamation-triangle fa-2x"></span><br> |
|
<?= __("Gli utenti di tipologia Amministratore sono automaticamente abilitati") ?> |
|
</div> |
|
<? |
|
if (!empty($utenti)) { |
|
$bind = array(); |
|
$utenti = $_SESSION["ente"]->getUtentiFromEnte($utenti,(int) $_GET["ente"]); |
|
if (!empty($utenti)) { |
|
$check = $pdo->prepare("SELECT codice FROM r_permessi WHERE sezione = :sezione AND codice_elemento = :codice_elemento AND codice_gestore = :codice_gestore AND codice_utente = :codice_utente AND funzione = :funzione"); |
|
$check->bindValue(":sezione",$_GET["sezione"]); |
|
$check->bindValue(":codice_gestore",$_SESSION["ente"]->codice); |
|
$check->bindValue(":codice_elemento",$_GET["codice_elemento"]); |
|
$functions = [["titolo"=>"Generale","descrizione"=>"Il permesso generale abilita l'utente a tutte le funzionalità compatibili con il suo profilo","value"=>0]]; |
|
$settings = $_SESSION["utente"]->settings[$_GET["sezione"]] ?? NULL; |
|
if (!empty($settings["funzioni"])) { |
|
$funct = $settings["funzioni"]; |
|
switch($funct["type"]) { |
|
case "json": |
|
$array = jsonToArray($config["jsonFolder"].$funct["path"]); |
|
if (!empty($array)) { |
|
foreach($array AS $value => $tmp) { |
|
$functions[] = [ |
|
"titolo"=>$tmp["titolo"], |
|
"descrizione"=>$tmp["descrizione"], |
|
"value"=>$value, |
|
"modulo_riferimento"=>$tmp["modulo_riferimento"] |
|
]; |
|
} |
|
} |
|
break; |
|
case "array": |
|
$functions = array_merge($functions,$funct["value"]); |
|
break; |
|
case "script": |
|
$functions = include_once "{$root}/{$funct["path"]}"; |
|
break; |
|
} |
|
} |
|
$getSezione = $_GET["sezione"]; |
|
$getCodice_elemento = $_GET["codice_elemento"]; |
|
$showAll = true; |
|
if ($_SESSION["utente"]->gerarchia > 10) { |
|
$check->bindValue(":funzione","0"); |
|
$check->bindValue(":codice_utente",$_SESSION["utente"]->codice); |
|
$check->execute(); |
|
$showAll = ($check->rowCount() > 0) ? true : false; |
|
} |
|
if (!$showAll) { |
|
$tmp = $functions; |
|
$functions = []; |
|
$check->bindValue(":codice_utente",$_SESSION["utente"]->codice); |
|
foreach($tmp AS $funzione) { |
|
$check->bindValue(":funzione",$funzione["value"]); |
|
$check->execute(); |
|
if ($check->rowCount() > 0) { |
|
$functions[] = $funzione; |
|
} else if ($funzione["value"] == "0") { |
|
$opened = true; |
|
} |
|
} |
|
} |
|
$hidden = ""; |
|
if (count($functions) > 1) { |
|
?> |
|
<div id="permission-select"> |
|
<? |
|
foreach($functions AS $funzione) { |
|
if (!isset($funzione["modulo_riferimento"]) || $funzione["modulo_riferimento"] == $getSezione) { |
|
if ($funzione["value"] != "0" && !isset($opened)) { |
|
$opened = true; |
|
?><div class="permission-advanced collapse pt-2"><? |
|
} |
|
?> |
|
<button type="button" onClick="showModalWithURL('<?= url_with_params("/backend/utenti/permessi/specific/table.php?function={$funzione["value"]}") ?>')" class="btn btn-block btn-primary text-left"> |
|
<?= __($funzione["titolo"]) ?><br> |
|
<small><?= __($funzione["descrizione"]) ?></small> |
|
</button> |
|
<? |
|
if ($funzione["value"] == "0") { |
|
?> |
|
<button type="button" onClick="$('.permission-advanced').slideToggle()" class="btn btn-block btn-sm btn-warning"> |
|
<span class="fa fa-plus permission-advanced"></span> <span class="fa fa-minus collapse permission-advanced"></span> <?= __("Opzioni avanzate") ?> |
|
</button> |
|
<? |
|
} |
|
} |
|
} |
|
?> |
|
</div> |
|
</div> |
|
<? |
|
$hidden = "collapse"; |
|
} |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|