Example #1
0
 public static function isLegalIdc($name)
 {
     $zks = json_decode(QConf::getConf("/qconf/zk/location"), TRUE);
     if (array_key_exists($name, $zks)) {
         return TRUE;
     }
     return FALSE;
 }
Example #2
0
 public static function getAllZk()
 {
     $zks = json_decode(QConf::getConf("/qconf/zk/location"), TRUE);
     foreach ($zk as $idc => $l) {
         echo "{$idc} => {$l}" . PHP_EOL;
         QconfMgrLog::err(__FILE__, __LINE__, "{$idc} => {$l}");
     }
     return $zks;
 }
 private function getPermission($username)
 {
     if ($username === "") {
         return FALSE;
     }
     $json_perms = QConf::getConf("/qconf/extra/perm");
     $perms = json_decode($json_perms, TRUE);
     if (!isset($perms[$username])) {
         return FALSE;
     } else {
         return $perms[$username];
     }
 }
Example #4
0
function node_operation($op, $config_val, $line)
{
    global $config_path, $idc, $waiting_time;
    echo_color("[==BEGIN==============================]", GREEN);
    assert(TRUE === zoo_node_opeartion($op, $config_val));
    if (OP_NODE_ADD === $op) {
        $value = QConf::getConf("{$config_path}");
    }
    sleep($waiting_time);
    $value = QConf::getConf("{$config_path}");
    var_dump($value);
    print_info($value == $config_val, $line);
    print_check_script(TRUE === check_script_result($config_path, $idc, "2", $waiting_time + 2), $line);
    //check script execute
    feedback_compare($config_path, 2);
    //check feedback
    echo_color("[===============================END==]", GREEN);
    echo PHP_EOL . PHP_EOL;
}
Example #5
0
 private static function getAdmins()
 {
     return json_decode(QConf::getConf("/qconf/perm/user_info"), TRUE);
 }
 public function checkSuperAdmin($super_admin)
 {
     if ($super_admin === NULL || $super_admin === "") {
         QconfMgrLog::err(__FILE__, __LINE__, "amdin_user or main_buss_id is NULL");
         return FALSE;
     }
     $admin_list = json_decode(QConf::getConf("/qconf/perm/user_info"), TRUE);
     if (!array_key_exists($super_admin, $admin_list)) {
         return InfoDescUtil::ERR_USER_PERM_SUPER_ADMIN_NOT_EXIST;
     }
     return InfoDescUtil::QCONF_OK;
 }