Esempio n. 1
0
     $groups[$arr["vgid"]] = $arr["name"];
 }
 $result = sqlquery("SELECT vid, variable.name AS name, path, state, variable.vgid AS vgid, variable_group.name AS group_name FROM variable, variable_group WHERE variable.vgid=variable_group.vgid" . ($selGroup > 0 ? " AND variable.vgid='{$selGroup}'" : "") . " ORDER BY group_name, name");
 while ($result && ($arr = mysql_fetch_array($result))) {
     $arr["priv"] = "inv";
     $vars[] = $arr;
 }
 $result = sqlquery("SELECT vid, privilege FROM user_variable WHERE uid='{$editUser}'");
 while ($result && ($arr = mysql_fetch_array($result))) {
     for ($i = 0; $i < count($vars) && $vars[$i]["vid"] != $arr["vid"]; ++$i) {
     }
     if ($i < count($vars)) {
         $vars[$i]["priv"] = $arr["privilege"];
     }
 }
 $usrVarRights = getUserVariableRights($editUser, $userGroup);
 echo "<table border=1>\n";
 echo "<tr><th>Variable</th><form method=post action='" . $_SERVER['PHP_SELF'] . "?editUser={$editUser}'><th>";
 echo "<select name='selGroup' onChange='submit()'>";
 $found = false;
 foreach ($groups as $vgid => $group) {
     echo "<option value='{$vgid}'" . ($selGroup == $vgid ? " selected" : "") . ">{$group}";
 }
 echo "<option value='-1'" . ($selGroup == "-1" ? " selected" : "") . ">All groups";
 echo "</select>";
 echo "</th></form><th>Path</th><th>Rights</th></tr>";
 echo "<form method=post action='{$resURL}'>\n";
 if (count($vars) > 0) {
     foreach ($vars as $var => $state) {
         $vid = $state["vid"];
         $usrVar = $usrVarRights[$vid];
Esempio n. 2
0
    }
    // override from group settings
    $result = sqlquery("SELECT vid, privilege FROM user_variable WHERE uid='{$gid}'");
    while ($result && ($array = sqlfetch($result))) {
        $uservariablerights[$array["vid"]][0] = 2;
        $uservariablerights[$array["vid"]][2] = $array["privilege"];
    }
    // override from user settings
    $result = sqlquery("SELECT vid, privilege FROM user_variable WHERE uid='{$uid}'");
    while ($result && ($array = sqlfetch($result))) {
        $uservariablerights[$array["vid"]][0] = 3;
        $uservariablerights[$array["vid"]][3] = $array["privilege"];
    }
    return $uservariablerights;
}
$userUserVariableRights = getUserVariableRights($uid, $gid);
function hasAccessToVariable($vid)
{
    global $userUserVariableRights;
    $var =& $userUserVariableRights[$vid];
    return isset($var) && $var[$var[0]] != "none";
}
function getVariableRight($vid)
{
    global $userUserVariableRights;
    $var =& $userUserVariableRights[$vid];
    return $var[$var[0]];
}
function getShardLockState()
{
    global $shardLockState, $uid, $REMOTE_ADDR, $enablelock, $shardList;