.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
global $G_TABLE;
//global $G_CONTENT;
//global $_SESSION;
global $collapsed;
global $URI_VARS;
global $pathViewChart;
global $appid;
global $rolid;
global $parents;
//global $dbc;
global $ses;
global $accessChangeRole;
$appid = $_SESSION['CURRENT_APPLICATION'];
$rolid = $_SESSION['CURRENT_ROLE'];
$parents = $_SESSION['CURRENT_ROLE_PARENTS'];
//$pathViewChart = "../";
//$nodo = $URI_VARS[0];
//if ($nodo == "")
$pathViewChart = "";
//Obtener nombre de la applicacion
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
G::LoadClassRBAC ('applications');
G::LoadClassRBAC ('roles');
$obj = new RBAC_Application;
$obj->SetTo ($dbc);
$obj->Load ($appid);
$_SESSION['STR_APP'] = $obj->Fields['APP_CODE'];;
$obj = new RBAC_Role;
$obj->SetTo($dbc);
$obj->Load($rolid);
$_SESSION['STR_ROL'] = $obj->Fields['ROL_CODE'];
//$appCode = G::LoadMessage (13);
//print "
$appCode";
$ses = new DBSession;
$ses->SetTo ($dbc);
$dbc = new DBConnection(DB_HOST, DB_RBAC_USER, DB_RBAC_PASS, DB_RBAC_NAME);
$ses = new DBSession;
$ses->SetTo($dbc);
function showLevel ( $i, $label1, $texto1, $texto2, $uid) {
global $pathViewChart;
global $collapsed;
global $rolid;
global $parents;
global $dbc;
global $ses;
global $canCreateRole;
$MAX_LEVEL = 10;
$sql = "SELECT count(*) AS CANT from ROLE_PERMISSION WHERE ROL_UID in ($parents ) AND PRM_UID = $uid";
$dset = $ses->Execute($sql);
$row2 = $dset->Read();
$rolStatus = $row2['CANT'];
if ($rolStatus == 1 ) {
$icon = "btnYellow";
$rolStatus = 2; //permiso heredado por roles superiores
}
else {
$sql = "SELECT count(*) AS CANT from ROLE_PERMISSION WHERE ROL_UID = $rolid AND PRM_UID = $uid";
$dset = $ses->Execute($sql);
$row2 = $dset->Read();
$rolStatus = $row2['CANT'];
$icon = "btnRed";
if ( $rolStatus != 0 ) $icon = "btnGreen";
}
$link = "
";
if ($rolStatus != 2 ) {
$link = "";
if ($canCreateRole == 1) $link = "";
$link .= "
";
if ($canCreateRole == 1) $link .= "";
}
print "";
for ( $j = 0; $j < $i; $j ++) print "| | ";
print " " . $link . " ";
//print $label . " ";
print " $texto1 $texto2 ";
print " | ";
print "
";
}
function walkLevel ( $level, $label, $parent ) {
global $collapsed;
global $appid;
global $dbc;
$sql = "SELECT UID, PRM_CODE, PRM_DESCRIPTION from PERMISSION WHERE PRM_APPLICATION = $appid AND PRM_PARENT = " . $parent ;
$ses = new DBSession ($dbc);
$dset = $ses->Execute ($sql);
$row = $dset->Read();
$c = 1;
while ( is_array ($row) ) {
if ($label === "*" )
{ $label = ""; $locLabel = $c; }
else
$locLabel = $label . "." . $c;
showLevel ( $level , $locLabel, $row['PRM_CODE'], $row['PRM_DESCRIPTION'], $row['UID'] );
walkLevel ( $level + 1, $locLabel, $row['UID']);
$c++;
$row = $dset->Read();
}
}
?>