| 63 | } |
| 64 | |
| 65 | func (s *Server) ListNamespaces(ctx context.Context, in *api.ListNamespacesRequest) ( |
| 66 | *api.ListNamespacesResponse, error) { |
| 67 | |
| 68 | if err := AuthSuperAdmin(ctx); err != nil { |
| 69 | s := status.Convert(err) |
| 70 | return nil, status.Error(s.Code(), |
| 71 | "Non superadmin user cannot list namespaces. "+s.Message()) |
| 72 | } |
| 73 | |
| 74 | dataNsList := make(map[uint64]*api.Namespace) |
| 75 | for ns := range schema.State().Namespaces() { |
| 76 | dataNsList[ns] = &api.Namespace{Id: ns} |
| 77 | } |
| 78 | |
| 79 | return &api.ListNamespacesResponse{Namespaces: dataNsList}, nil |
| 80 | } |