def list(self): """ 用户组列表 /group/ :return: """ page = int(request.args.get('page', 0)) page = page - 1 if page else 0 size = int(request.args.get('size', 10)) kw = request.values.get('kw', '') space_model = SpaceModel() space_list, count = space_model.list(page=page, size=size, kw=kw) return self.list_json(list=space_list, count=count, enable_create=permission.enable_role(OWNER)) group_model, count = SpaceModel().query_paginate( page=page, limit=size, filter_name_dict=filter) groups = [] for group_info in group_model: group_sub = MemberModel.query \ .filter_by(group_id=group_info.id) \ .count() group_info = group_info.to_json() group_info['users'] = group_sub group_info['group_id'] = group_info['id'] group_info['group_name'] = group_info['name'] groups.append(group_info) return self.list_json(list=groups, count=count)
def list(self): """ 用户组列表 /group/ :return: """ page = int(request.args.get('page', 0)) page = page - 1 if page else 0 size = int(request.args.get('size', 10)) kw = request.values.get('kw', '') space_model = SpaceModel() space_list, count = space_model.list(page=page, size=size, kw=kw) return self.list_json(list=space_list, count=count, enable_create=permission.role_upper_owner()) group_model, count = SpaceModel().query_paginate(page=page, limit=size, filter_name_dict=filter) groups = [] for group_info in group_model: group_sub = MemberModel.query \ .filter_by(group_id=group_info.id) \ .count() group_info = group_info.to_json() group_info['users'] = group_sub group_info['group_id'] = group_info['id'] group_info['group_name'] = group_info['name'] groups.append(group_info) return self.list_json(list=groups, count=count)
def list(self, space_id=None): """ fetch space list :return: """ page = int(request.args.get('page', 0)) page = page - 1 if page else 0 size = int(request.args.get('size', 10)) kw = request.values.get('kw', '') space_model = SpaceModel() space_list, count = space_model.list(page=page, size=size, kw=kw) return self.list_json(list=space_list, count=count, enable_create=permission.enable_role(OWNER))