Пример #1
0
def disable_user(type,id):
    try:
        user = OA_User.query.filter_by(id=id).first()
        user.active = type
        
        # 事务提交
        db.session.commit()
        # 消息闪现
        return helpers.show_result_success('保存成功')
    except:
        # 回滚
        db.session.rollback()
        logger.exception('exception')
        return helpers.show_result_fail('保存失败')
Пример #2
0
def check_new_privilege(type,p_id):
    prv = OA_ProjectGroup.query.filter_by(type=type,project_id=p_id,user_id=current_user.id).all()
    if prv:
        return helpers.show_result_success("Success")
    else:
        return helpers.show_result_fail("Failed")