Hi guys, I’m working on authorizations management and access to the pages with my script.
I have an “authorizations” (permessi) array and another one that generates the menu and the authorizations that belong to.
Until this point the process has a good end and I create menu according user’s authorizations.
For every authorization but the widget, a key is created into the header: the widget, in fact, contains two permissions.
Then there’s the problem: while an user has only the authorization for the widget he can also reach other keys. Can you help me with it?
This is the code that creates the keys to reach the sections according to the available authorizations.
$permessi = array(
"Widget Organigramma" => "widget_organigramma",
"Widget Bandi" => "widget_bandi"
);
$setting_permesso["widget"] = array("Widget", "index.php?a=widget",
"menu" => array(
"Orgranigramma" => array(
"Genera" =>"index.php?a=widget&module=creaOrganigramma",
"Modifica" =>"index.php?a=widget&module=MOrganigramma"
),
"Bandi" => array(
"Genera" =>"index.php?a=widget&module=creaBAndi",
"Modifica" =>"index.php?a=widget&module=MBandi"
),
)
);
foreach($setting_permesso as $cat => $value){
//Active
if("index.php?cat_kude=".$controllo_get == $value[1]){
$add = "id=\"menu-active\"";
}else{
$add = "id=\"\"";
}
if($xplode_menu[0] == "all"){
echo "<li $add><a href=\"$value[1]\"><span>$value[0]</span></a></li>";
}else{
if(preg_match("/widget/i", $_SESSION["level"])){
echo "<li $add><a href=\"$value[1]\"><span>$value[0]</span></a></li>";
}
if(in_array($cat,$xplode_menu )) {
echo "<li $add><a href=\"$value[1]\"><span>$value[0]</span></a></li>";
}
}
}