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
def find_groups_by_user_name(cls, org, user_name): user = UserBusiness.find_user_by_org_name(org, user_name) for i in user.group: yield i pass
def user_delete(cls, name, org): user = UserBusiness.find_user_by_org_name(org, name) if user: UserBusiness.delete_user_by_id(user.id)