Exemplo n.º 1
0
def __repo_update(user):
    db_template.update('update T_USER set USERNAME = ?, PASSWORD = ?, NAME = ? where ID = ?', (user.username, user.password, user.name, user.id))
    db_template.update('delete from T_USER_GROUP where USER_ID = ?', (user.id,))
    if user.groups:
        [db_template.insert('insert into T_USER_GROUP (USER_ID, GROUP_ID) values (?, ?)', (user.id, group.id)) for group in user.groups]
    db_template.update('delete from T_USER_ROLE where USER_ID = ?', (user.id,))
    if user.roles:
        [db_template.insert('insert into T_USER_ROLE (USER_ID, ROLE_ID) values (?, ?)', (user.id, role.id)) for role in user.roles]
Exemplo n.º 2
0
def __repo_save(log):
    log.id = db_template.insert('insert into T_LOG (TIME, OPERATOR, RESOURCE_NAME, RESOURCE_PATH, ARGUMENTS, STATUS, MESSAGE) VALUES (?, ?, ?, ?, ?, ?, ?)', (log.time, log.operator, log.resource_name, log.resource_path, log.arguments, log.status, log.message))
Exemplo n.º 3
0
def __repo_update(group):
    db_template.update('update T_GROUP set NAME = ?, PARENT_ID = ?, DESCRIPTION = ? where ID = ?', (group.name, group.parent.id if group.parent else None, group.description, group.id))
    db_template.update('delete from T_GROUP_ROLE where GROUP_ID = ?', (group.id,))
    if group.roles:
        [db_template.insert('insert into T_GROUP_ROLE (GROUP_ID, ROLE_ID) values (?, ?)', (group.id, role.id)) for role in group.roles]
Exemplo n.º 4
0
def __repo_save(user):
    user.id = db_template.insert('insert into T_USER (USERNAME, PASSWORD, NAME) VALUES (?, ?, ?)', (user.username, user.password, user.name))
Exemplo n.º 5
0
def __repo_save(group):
    group.id = db_template.insert('insert into T_GROUP (NAME, PARENT_ID, DESCRIPTION) values (?, ?, ?)', (group.name, group.parent.id if group.parent else None, group.description))