예제 #1
0
def changPwd(HOSTNAME, username, lastPassword, password):
    url = HOSTNAME + "/user/modpwd"
    textmod = {
        "username": username,
        "last_password": lastPassword,
        "password": password
    }
    return post(url, textmod)
예제 #2
0
def createRole(HOSTNAME, APPNAME, roleName, is_managent, create_uid):
    url = HOSTNAME + "/role/create"
    textmod = {
        "role": {
            "app_name": APPNAME,
            "name": roleName,
            "create_uid": create_uid,
            "is_managent": is_managent
        }
    }
    return post(url, textmod)
예제 #3
0
def changePermit(HOSTNAME, APPNAME, pid, name, desc):
    url = HOSTNAME + "/perms/change"
    textmod = {
        "perm": {
            "app_name": APPNAME,
            "id": pid,
            "name": name,
            "desc": desc
        }
    }
    return post(url, textmod)
예제 #4
0
def createOrg(HOSTNAME, APPNAME, name, code, owner="", desc="", rid=""):
    url = HOSTNAME + "/orgTree/create"
    textmod = {
        "rid": rid,
        "node": {
            "app_name": APPNAME,
            "code": code,
            "name": name,
            "desc": desc,
            "owner": owner
        }
    }
    return post(url, textmod)
예제 #5
0
def createPermit(HOSTNAME, APPNAME, permitName, code="", desc=""):
    url = HOSTNAME + "/perms/create"
    if not code:
        code = permitName


#     textmod = {"perm":{"app_name":APPNAME, "name":code, "desc" : desc}}
    textmod = {
        "perm": {
            "app_name": APPNAME,
            "name": permitName,
            "code": code,
            "desc": desc
        }
    }
    return post(url, textmod)
예제 #6
0
def createUser(HOSTNAME,
               APPNAME,
               username,
               password,
               orgName="网络管理员",
               nickname="",
               nid=0,
               sort_type=999999999):
    url = HOSTNAME + "/user/add"
    textmod = {
        "user": {
            "username": username,
            "password": password,
            "app_name": APPNAME,
            "nickname": nickname,
            "nid": nid,
            "sort_type": sort_type
        }
    }
    if orgName:
        textmod["user"]["payload"] = '{"organization":"%s"}' % orgName
    return post(url, textmod)
예제 #7
0
def cleanRoleBatch(HOSTNAME, APPNAME, username):
    url = HOSTNAME + "/user/cleanRole"
    textmod = {"username": username, "app_name": APPNAME}
    return post(url, textmod)
예제 #8
0
def assinRoleBatch(HOSTNAME, APPNAME, username, rid):
    url = HOSTNAME + "/user/assignRoleBatch"
    textmod = {"username": username, "rid": rid, "app_name": APPNAME}
    return post(url, textmod)
예제 #9
0
def assinRole(HOSTNAME, APPNAME, username, rid, init=None):
    url = HOSTNAME + "/user/assignRole"
    textmod = {"username": username, "rid": rid, "app_name": APPNAME}
    if init:
        textmod["init"] = 1
    return post(url, textmod)
예제 #10
0
def bindOrgUser(HOSTNAME, uid, nid):
    url = HOSTNAME + "/orgTree/bindUser"
    textmod = {"uid": uid, "nid": nid}
    return post(url, textmod)
예제 #11
0
def login(HOSTNAME, APPNAME, username, password):
    url = HOSTNAME + "/user/login"
    textmod = {"username": username, "password": password, "app_name": APPNAME}
    return post(url, textmod)