def Query(self, id=None): self.role = Role.first_or_new(id=id) permissions = Permission.order_by('sort', 'asc').get() actions = [] if hasattr(self.role, 'actions'): actions = self.role.actions.pluck('id').to_json() permission = {'permissions': permissions, 'actions': actions} return {'role': self.role, 'permission': permission}
def Query(self, **kwargs): permissions = Permission.order_by('sort', 'asc').get() return {'permission': permissions}