Beispiel #1
0
def update( id, name, sort, rights, customJson, remark, user):
    if not _check_customJson(customJson):
        raise error.RightError(code = 102001)
    rr = _check_and_format_rights(rights)
    if False == rr[0]:
        raise error.RightError(code = rr[1])
    rights2 = rr[1]
    yz = (name, sort, rights2, customJson, remark, user, id)
    result = mysql.insert_or_update_or_delete(_update_sql, yz)
    return 0 == result
Beispiel #2
0
def add(name, code, developer, url, status, remark, user):
    obj = query_one_by_name(name=name)
    if None != obj:
        raise error.RightError(code=101001)
    obj = query_one(code=code)
    if None != obj:
        raise error.RightError(code=101005)

    isdelete = state.Boole['false']
    yz = (code, name, developer, url, status, remark, isdelete, user, user)
    result = mysql.insert_or_update_or_delete(_add_sql, yz)
    return 0 == result
Beispiel #3
0
def add(appCode, name, code, parentID, path, rights, customJson,
                    sort, status, remark, user):
    if not _check_customJson(customJson):
        raise error.RightError(code = 102001)
    rr = _check_and_format_rights(rights)
    if False == rr[0]:
        raise error.RightError(code = rr[1])
    rights2 = rr[1]
    isdelete = state.Boole['false']
    yz = (appCode, name, code, parentID, path, rights2, customJson,
                    sort, status, remark, isdelete, user, user)
    result = mysql.insert_or_update_or_delete(_add_sql, yz, True)
    return result
Beispiel #4
0
def update(id, name, status, remark, user):
    obj = query_one_by_name(name=name)
    if None != obj and str(obj['id']) != str(id):
        raise error.RightError(code=106001)

    isdelete = state.Boole['false']
    yz = (name, status, remark, user, id)
    result = mysql.insert_or_update_or_delete(_update_sql, yz)
    return 0 == result
Beispiel #5
0
def add(name, status, remark, user):
    obj = query_one_by_name(name=name)
    if None != obj:
        raise error.RightError(code=105001)

    isdelete = state.Boole['false']
    yz = (name, status, remark, isdelete, user, user)
    ugid = mysql.insert_or_update_or_delete(_add_sql, yz, True)
    return ugid
Beispiel #6
0
def update(name, code, developer, url, status, remark, user):
    obj = query_one_by_name(name=name)
    if None != obj and obj['code'] != str(code):
        raise error.RightError(code=101001)

    isdelete = state.Boole['false']
    yz = (name, developer, url, status, remark, user, code)
    result = mysql.insert_or_update_or_delete(_update_sql, yz)
    return 0 == result
Beispiel #7
0
def delete( id, user):
    isdelete = state.Boole['true']
    func = query_one_by_id(id = id)
    if None == func:
        raise error.RightError(code=102002)
    path = func['path'] + '.%'
    yz = (isdelete, user, id, path)
    result = mysql.insert_or_update_or_delete(_delete_sql, yz)
    return 0 == result