Beispiel #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;
 }
Beispiel #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];
     }
 }
Beispiel #4
0
function batch_operation(&$nodes, &$ops, &$cur_batch_nodes, $line, $first_time = FALSE)
{
    global $batch_path, $idc, $waiting_time;
    echo_color("[==BEGIN==============================]", GREEN);
    assert(TRUE === zoo_batch_operation($nodes, $ops, $cur_batch_nodes));
    if ($first_time) {
        $children = QConf::getBatchConf($batch_path);
    }
    sleep($waiting_time);
    $children = QConf::getBatchConf($batch_path);
    var_dump($children);
    print_info($children == $cur_batch_nodes, $line);
    $keys = QConf::getBatchKeys($batch_path);
    var_dump($keys);
    print_info($keys == array_keys($cur_batch_nodes), $line);
    //print_check_script(TRUE === check_script_result($batch_path, $idc, "4", $waiting_time + 2), $line);
    echo_color("[===============================END==]", GREEN);
    echo PHP_EOL . PHP_EOL;
}
Beispiel #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;
 }