Exemplo n.º 1
0
 def manage(cls, user, user_group, role):
     # 数据库添加用户
     UserBusiness.add_user(user)
     # 用户添加组
     if user_group is not None:
         user.group.append(user_group)
     # 用户添加角色
     # roles = find_all_roles()
     user.roles.append(role)
     pass
Exemplo n.º 2
0
 def user_add(cls, data):
     user = UserBusiness.create_user(data)
     if type(user) == str:
         return user
     name = user.name
     oa = str(user.organization)
     # 同一个应用下,用户名唯一,也即name+org 唯一
     if UserBusiness.find_user_by_org_name(oa, name):
         # if UserBusiness.find_user_by_name(username):
         return "用户已存在,请重新输入!"
     else:
         UserBusiness.add_user(user)
         
     return user