Beispiel #1
0
def get_users():
    fields = [
        'id', 'username', 'phone', 'role', 'cn_name', 'position', 'password',
        'email'
    ]
    sql = '''SELECT %s FROM users; ''' % ','.join(fields)
    print sql
    values = select_all_result(sql)
    retdata = [dict(zip(fields, value)) for value in values]
    return retdata
Beispiel #2
0
def checkname(username):
    ret = 0
    sql = '''select username from users; '''
    usernames = select_all_result(sql)
    for x in range(len(usernames)):
        if "".join(tuple(usernames[x])) == username['username']:
            ret = 1
    if ret == 1:
        return False
    else:
        return True
Beispiel #3
0
def get_user(name):
    sql = '''SELECT id,username,password,email FROM users WHERE username = '******';''' % name
    return select_all_result(sql)
Beispiel #4
0
def get_users():
    sql = '''SELECT id,username,password,email,role FROM users '''
    return select_all_result(sql)
Beispiel #5
0
def get_user(name):
    sql = '''SELECT * FROM users WHERE username = '******';''' % name
    return select_all_result(sql)
Beispiel #6
0
def get_users():
    sql = '''SELECT * FROM users '''
    return select_all_result(sql)
Beispiel #7
0
def get_assets():
    sql = '''SELECT * FROM assets '''
    return select_all_result(sql)
Beispiel #8
0
def assets_get():
    sql = '''SELECT id,hostname,status,i_ip,e_ip,ram,hd,cpu,cpu_model,address,update_date FROM assets'''
    return select_all_result(sql)