示例#1
0
def get_current_user(request):
    user_id = request.session.get('user_id', None)
    user = None
    if user_id is not None:
        user = User.by_id(user_id)
    return user if user else None
示例#2
0
文件: libs.py 项目: tony-hub/myoa
def user_add_role_lib(userid, roleid):
    user = User.by_id(userid)
    role = Role.by_id(roleid)
    if user and role:
        role.users.add(user)