You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2026/07/06 08:32:29 UTC

(airavata-custos) 01/01: Add list endpoints for users and organizations

This is an automated email from the ASF dual-hosted git repository.

lahirujayathilake pushed a commit to branch endpoints
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git

commit ce9eb17f4585349b150a551202aed5968c7f322c
Author: lahiruj <la...@gmail.com>
AuthorDate: Mon Jul 6 04:32:21 2026 -0400

     Add list endpoints for users and organizations
---
 api/core.openapi.yaml                | 62 ++++++++++++++++++++++++++++++++++++
 docs/privileges.md                   |  4 +--
 internal/server/organization.go      | 21 ++++++++++++
 internal/server/responses.go         | 12 +++++++
 internal/server/server.go            |  2 ++
 internal/server/user.go              | 21 ++++++++++++
 internal/store/organization_store.go | 22 +++++++++++++
 internal/store/store.go              |  4 +++
 internal/store/user_store.go         | 22 +++++++++++++
 pkg/service/organization.go          |  9 ++++++
 pkg/service/user.go                  |  9 ++++++
 web/src/generated/core/index.ts      |  4 +--
 web/src/generated/core/sdk.gen.ts    | 20 +++++++++++-
 web/src/generated/core/types.gen.ts  | 60 ++++++++++++++++++++++++++++++++++
 web/src/generated/core/zod.gen.ts    | 34 ++++++++++++++++++++
 15 files changed, 301 insertions(+), 5 deletions(-)

diff --git a/api/core.openapi.yaml b/api/core.openapi.yaml
index dba6bba8b..c4565483f 100644
--- a/api/core.openapi.yaml
+++ b/api/core.openapi.yaml
@@ -303,6 +303,15 @@ definitions:
           Record ID.'
         type: string
     type: object
+  OrganizationListResponse:
+    properties:
+      items:
+        items:
+          $ref: '#/definitions/Organization'
+        type: array
+      total:
+        type: integer
+    type: object
   PrivilegeKey:
     enum:
     - core:clusters:read
@@ -556,6 +565,15 @@ definitions:
       user_id:
         type: string
     type: object
+  UserListResponse:
+    properties:
+      items:
+        items:
+          $ref: '#/definitions/User'
+        type: array
+      total:
+        type: integer
+    type: object
   UserPrivilege:
     properties:
       granted_at:
@@ -2616,6 +2634,28 @@ paths:
       tags:
       - Caller
   /organizations:
+    get:
+      parameters:
+      - description: Page size
+        in: query
+        name: limit
+        type: integer
+      - description: Page offset
+        in: query
+        name: offset
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/OrganizationListResponse'
+      security:
+      - BearerAuth: []
+      summary: List organizations (paginated)
+      tags:
+      - Organizations
     post:
       consumes:
       - application/json
@@ -3439,6 +3479,28 @@ paths:
       tags:
       - Caller
   /users:
+    get:
+      parameters:
+      - description: Page size
+        in: query
+        name: limit
+        type: integer
+      - description: Page offset
+        in: query
+        name: offset
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/UserListResponse'
+      security:
+      - BearerAuth: []
+      summary: List users (paginated)
+      tags:
+      - Users
     post:
       consumes:
       - application/json
diff --git a/docs/privileges.md b/docs/privileges.md
index ae002812e..afedecd13 100644
--- a/docs/privileges.md
+++ b/docs/privileges.md
@@ -29,9 +29,9 @@ should be migrated.
 | `core:allocations:write` | Every `POST` / `PUT` / `DELETE` across the same allocation family                                                                                                                                                                                                                                                                                                                                                                       |
 | `core:projects:read`     | `GET /projects`, `GET /projects/{id}`, `GET /projects/{id}/members`                                                                                                                                                                                                                                                                                                                                                                     |
 | `core:projects:write`    | `POST /projects`, `PUT /projects/{id}/status`                                                                                                                                                                                                                                                                                                                                                                                           |
-| `core:users:read`        | `GET /users/{id}`, `GET` endpoints under `/user-identities*`, `GET /users/{id}/user-identities` (user identities are user records, so they share the `users` scope)                                                                                                                                                                                                                                                                     |
+| `core:users:read`        | `GET /users`, `GET /users/{id}`, `GET` endpoints under `/user-identities*`, `GET /users/{id}/user-identities` (user identities are user records, so they share the `users` scope)                                                                                                                                                                                                                                                       |
 | `core:users:write`       | `POST /users`, `PUT /users/{id}/status`, `POST /users/merge`, `POST /user-identities`, `PUT /user-identities/{id}`, `DELETE /user-identities/{id}`                                                                                                                                                                                                                                                                                      |
-| `core:organizations:read`  | `GET /organizations/{id}`                                                                                                                                                                                                                                                                                                                                                                                                             |
+| `core:organizations:read`  | `GET /organizations`, `GET /organizations/{id}`                                                                                                                                                                                                                                                                                                                                                                                       |
 | `core:organizations:write` | `POST /organizations`                                                                                                                                                                                                                                                                                                                                                                                                                 |
 | `core:traces:read`       | `GET /audit/traces`, `GET /audit/traces/{trace_id}`, `GET /audit/events`, `GET /audit/sources`                                                                                                                                                                                                                                                                                                                                          |
 | `core:privileges:grant`  | `GET /privileges/catalog`, `GET /users/{id}/privileges`, `GET /privileges/{key}/holders`, `POST /users/{id}/privileges`, `DELETE /users/{id}/privileges/{key}`                                                                                                                                                                                                                                                                          |
diff --git a/internal/server/organization.go b/internal/server/organization.go
index ae9068847..8a83c29c3 100644
--- a/internal/server/organization.go
+++ b/internal/server/organization.go
@@ -47,6 +47,27 @@ func (s *Server) createOrganization(w http.ResponseWriter, r *http.Request) {
 	common.WriteJSON(w, http.StatusCreated, created)
 }
 
+// @Summary	List organizations (paginated)
+// @Tags	Organizations
+// @Security	BearerAuth
+// @Produce	json
+// @Param	limit	query	integer	false	"Page size"
+// @Param	offset	query	integer	false	"Page offset"
+// @Success	200	{object}	OrganizationListResponse
+// @Router	/organizations [get]
+func (s *Server) listOrganizations(w http.ResponseWriter, r *http.Request) {
+	q := r.URL.Query()
+	rows, total, err := s.svc.ListOrganizations(r.Context(), atoiOr(q.Get("limit"), 50), atoiOr(q.Get("offset"), 0))
+	if err != nil {
+		common.WriteServiceError(w, err)
+		return
+	}
+	if rows == nil {
+		rows = []models.Organization{}
+	}
+	common.WriteJSON(w, http.StatusOK, OrganizationListResponse{Items: rows, Total: total})
+}
+
 // @Summary	Get an organization by ID
 // @Tags	Organizations
 // @Security	BearerAuth
diff --git a/internal/server/responses.go b/internal/server/responses.go
index 7af35db25..7072d01e8 100644
--- a/internal/server/responses.go
+++ b/internal/server/responses.go
@@ -38,6 +38,18 @@ type ProjectListResponse struct {
 	Total int               `json:"total"`
 }
 
+// OrganizationListResponse is the paginated list envelope for organizations.
+type OrganizationListResponse struct {
+	Items []models.Organization `json:"items"`
+	Total int                   `json:"total"`
+}
+
+// UserListResponse is the paginated list envelope for users.
+type UserListResponse struct {
+	Items []models.User `json:"items"`
+	Total int           `json:"total"`
+}
+
 // ProjectMemberAllocationRef carries the (allocation, role) the user holds on
 // one of the project's allocations.
 type ProjectMemberAllocationRef struct {
diff --git a/internal/server/server.go b/internal/server/server.go
index ee812e80b..3f862cd35 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -66,9 +66,11 @@ func (s *Server) routes() {
 	s.router.Public("GET /healthz", s.healthz)
 
 	s.router.RequirePrivilege("POST /organizations", models.OrganizationsWrite, s.createOrganization)
+	s.router.RequirePrivilege("GET /organizations", models.OrganizationsRead, s.listOrganizations)
 	s.router.RequirePrivilege("GET /organizations/{id}", models.OrganizationsRead, s.getOrganization)
 
 	s.router.RequirePrivilege("POST /users", models.UsersWrite, s.createUser)
+	s.router.RequirePrivilege("GET /users", models.UsersRead, s.listUsers)
 	s.router.RequirePrivilege("GET /users/{id}", models.UsersRead, s.getUser)
 	s.router.RequirePrivilege("PUT /users/{id}/status", models.UsersWrite, s.updateUserStatus)
 	s.router.RequirePrivilege("POST /users/merge", models.UsersWrite, s.mergeUsers)
diff --git a/internal/server/user.go b/internal/server/user.go
index fa01da0bc..f0ac34366 100644
--- a/internal/server/user.go
+++ b/internal/server/user.go
@@ -47,6 +47,27 @@ func (s *Server) createUser(w http.ResponseWriter, r *http.Request) {
 	common.WriteJSON(w, http.StatusCreated, created)
 }
 
+// @Summary	List users (paginated)
+// @Tags	Users
+// @Security	BearerAuth
+// @Produce	json
+// @Param	limit	query	integer	false	"Page size"
+// @Param	offset	query	integer	false	"Page offset"
+// @Success	200	{object}	UserListResponse
+// @Router	/users [get]
+func (s *Server) listUsers(w http.ResponseWriter, r *http.Request) {
+	q := r.URL.Query()
+	rows, total, err := s.svc.ListUsers(r.Context(), atoiOr(q.Get("limit"), 50), atoiOr(q.Get("offset"), 0))
+	if err != nil {
+		common.WriteServiceError(w, err)
+		return
+	}
+	if rows == nil {
+		rows = []models.User{}
+	}
+	common.WriteJSON(w, http.StatusOK, UserListResponse{Items: rows, Total: total})
+}
+
 // @Summary	Get a user by ID
 // @Tags	Users
 // @Security	BearerAuth
diff --git a/internal/store/organization_store.go b/internal/store/organization_store.go
index c606dcb5c..22bd7bc4d 100644
--- a/internal/store/organization_store.go
+++ b/internal/store/organization_store.go
@@ -62,6 +62,28 @@ func (s *mysqlOrganizationStore) FindByOriginatedID(ctx context.Context, origina
 	return &o, nil
 }
 
+func (s *mysqlOrganizationStore) List(ctx context.Context, limit, offset int) ([]models.Organization, int, error) {
+	var total int
+	if err := s.db.GetContext(ctx, &total, `SELECT COUNT(*) FROM organizations`); err != nil {
+		return nil, 0, err
+	}
+	if limit <= 0 {
+		limit = 50
+	}
+	if limit > 200 {
+		limit = 200
+	}
+	if offset < 0 {
+		offset = 0
+	}
+	var rows []models.Organization
+	if err := s.db.SelectContext(ctx, &rows,
+		`SELECT id, originated_id, name FROM organizations ORDER BY name LIMIT ? OFFSET ?`, limit, offset); err != nil {
+		return nil, 0, err
+	}
+	return rows, total, nil
+}
+
 func (s *mysqlOrganizationStore) Create(ctx context.Context, tx *sql.Tx, o *models.Organization) error {
 	_, err := tx.ExecContext(ctx,
 		`INSERT INTO organizations (id, originated_id, name) VALUES (?, ?, ?)`,
diff --git a/internal/store/store.go b/internal/store/store.go
index cc16b4209..dabdd5da2 100644
--- a/internal/store/store.go
+++ b/internal/store/store.go
@@ -31,6 +31,8 @@ type UserStore interface {
 	FindByID(ctx context.Context, id string) (*models.User, error)
 	// FindByEmail returns the user with the given email, or nil if not found.
 	FindByEmail(ctx context.Context, email string) (*models.User, error)
+	// List returns a page of users ordered by email, plus the total count.
+	List(ctx context.Context, limit, offset int) ([]models.User, int, error)
 	// GetUserByOIDCSub returns the user owning the user_identities row whose
 	// oidc_sub matches or nil if no row links the given subject.
 	GetUserByOIDCSub(ctx context.Context, oidcSub string) (*models.User, error)
@@ -52,6 +54,8 @@ type OrganizationStore interface {
 	FindByID(ctx context.Context, id string) (*models.Organization, error)
 	// FindByOriginatedID returns the organization matching the external originated ID, or nil if not found.
 	FindByOriginatedID(ctx context.Context, originatedID string) (*models.Organization, error)
+	// List returns a page of organizations ordered by name, plus the total count.
+	List(ctx context.Context, limit, offset int) ([]models.Organization, int, error)
 	// Create inserts a new organization within the provided transaction.
 	Create(ctx context.Context, tx *sql.Tx, o *models.Organization) error
 	// Update replaces mutable fields of an existing organization within the provided transaction.
diff --git a/internal/store/user_store.go b/internal/store/user_store.go
index 9b2c065f3..1e7695286 100644
--- a/internal/store/user_store.go
+++ b/internal/store/user_store.go
@@ -52,6 +52,28 @@ func (s *mysqlUserStore) FindByID(ctx context.Context, id string) (*models.User,
 	return &u, nil
 }
 
+func (s *mysqlUserStore) List(ctx context.Context, limit, offset int) ([]models.User, int, error) {
+	var total int
+	if err := s.db.GetContext(ctx, &total, `SELECT COUNT(*) FROM users`); err != nil {
+		return nil, 0, err
+	}
+	if limit <= 0 {
+		limit = 50
+	}
+	if limit > 200 {
+		limit = 200
+	}
+	if offset < 0 {
+		offset = 0
+	}
+	var rows []models.User
+	if err := s.db.SelectContext(ctx, &rows,
+		`SELECT `+userColumns+` FROM users ORDER BY email LIMIT ? OFFSET ?`, limit, offset); err != nil {
+		return nil, 0, err
+	}
+	return rows, total, nil
+}
+
 func (s *mysqlUserStore) FindByEmail(ctx context.Context, email string) (*models.User, error) {
 	var u models.User
 	err := s.db.GetContext(ctx, &u,
diff --git a/pkg/service/organization.go b/pkg/service/organization.go
index 15bb88925..bf8b446b3 100644
--- a/pkg/service/organization.go
+++ b/pkg/service/organization.go
@@ -70,6 +70,15 @@ func (s *Service) GetOrganization(ctx context.Context, id string) (*models.Organ
 	return org, nil
 }
 
+// ListOrganizations returns a page of organizations plus the total count.
+func (s *Service) ListOrganizations(ctx context.Context, limit, offset int) ([]models.Organization, int, error) {
+	rows, total, err := s.orgs.List(ctx, limit, offset)
+	if err != nil {
+		return nil, 0, fmt.Errorf("list organizations: %w", err)
+	}
+	return rows, total, nil
+}
+
 // GetOrganizationByOriginatedID retrieves an organization by its external originated ID.
 func (s *Service) GetOrganizationByOriginatedID(ctx context.Context, originatedID string) (*models.Organization, error) {
 	org, err := s.orgs.FindByOriginatedID(ctx, originatedID)
diff --git a/pkg/service/user.go b/pkg/service/user.go
index d86c89b03..e9dd3a0e8 100644
--- a/pkg/service/user.go
+++ b/pkg/service/user.go
@@ -71,6 +71,15 @@ func (s *Service) CreateUser(ctx context.Context, user *models.User) (*models.Us
 	return user, nil
 }
 
+// ListUsers returns a page of users plus the total count.
+func (s *Service) ListUsers(ctx context.Context, limit, offset int) ([]models.User, int, error) {
+	rows, total, err := s.users.List(ctx, limit, offset)
+	if err != nil {
+		return nil, 0, fmt.Errorf("list users: %w", err)
+	}
+	return rows, total, nil
+}
+
 // GetUser retrieves a user by ID. Returns ErrNotFound when no user matches.
 func (s *Service) GetUser(ctx context.Context, id string) (*models.User, error) {
 	u, err := s.users.FindByID(ctx, id)
diff --git a/web/src/generated/core/index.ts b/web/src/generated/core/index.ts
index 3c2cb8a81..e2d15c228 100644
--- a/web/src/generated/core/index.ts
+++ b/web/src/generated/core/index.ts
@@ -1,4 +1,4 @@
 // This file is auto-generated by @hey-api/openapi-ts
 
-export { deleteComputeAllocationChangeRequestEventsById, deleteComputeAllocationChangeRequestsById, deleteComputeAllocationDiffsById, deleteComputeAllocationMembershipResourceOverridesById, deleteComputeAllocationMembershipsById, deleteComputeAllocationsByIdResourcesByResourceId, deleteComputeAllocationUsagesById, deleteComputeClusterUsersById, deleteRolesById, deleteRolesByIdPrivilegesByKey, deleteUserIdentitiesById, deleteUsersByIdPrivilegesByKey, deleteUsersByIdRolesByRoleId, getAudit [...]
-export type { AllocationMembershipResponse, AllocationStatus, AllocationSuTotalResponse, AttachResourceRequest, CallerProfileResponse, ClientOptions, ComputeAllocation, ComputeAllocationChangeRequest, ComputeAllocationChangeRequestEvent, ComputeAllocationDiff, ComputeAllocationListResponse, ComputeAllocationMembership, ComputeAllocationMembershipResourceOverride, ComputeAllocationResource, ComputeAllocationResourceMapping, ComputeAllocationResourceRate, ComputeAllocationUsage, ComputeClu [...]
+export { deleteComputeAllocationChangeRequestEventsById, deleteComputeAllocationChangeRequestsById, deleteComputeAllocationDiffsById, deleteComputeAllocationMembershipResourceOverridesById, deleteComputeAllocationMembershipsById, deleteComputeAllocationsByIdResourcesByResourceId, deleteComputeAllocationUsagesById, deleteComputeClusterUsersById, deleteRolesById, deleteRolesByIdPrivilegesByKey, deleteUserIdentitiesById, deleteUsersByIdPrivilegesByKey, deleteUsersByIdRolesByRoleId, getAudit [...]
+export type { AllocationMembershipResponse, AllocationStatus, AllocationSuTotalResponse, AttachResourceRequest, CallerProfileResponse, ClientOptions, ComputeAllocation, ComputeAllocationChangeRequest, ComputeAllocationChangeRequestEvent, ComputeAllocationDiff, ComputeAllocationListResponse, ComputeAllocationMembership, ComputeAllocationMembershipResourceOverride, ComputeAllocationResource, ComputeAllocationResourceMapping, ComputeAllocationResourceRate, ComputeAllocationUsage, ComputeClu [...]
diff --git a/web/src/generated/core/sdk.gen.ts b/web/src/generated/core/sdk.gen.ts
index ebe1628ad..d8cd426e2 100644
--- a/web/src/generated/core/sdk.gen.ts
+++ b/web/src/generated/core/sdk.gen.ts
@@ -2,7 +2,7 @@
 
 import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client';
 import { client } from './client.gen';
-import type { DeleteComputeAllocationChangeRequestEventsByIdData, DeleteComputeAllocationChangeRequestEventsByIdErrors, DeleteComputeAllocationChangeRequestEventsByIdResponses, DeleteComputeAllocationChangeRequestsByIdData, DeleteComputeAllocationChangeRequestsByIdErrors, DeleteComputeAllocationChangeRequestsByIdResponses, DeleteComputeAllocationDiffsByIdData, DeleteComputeAllocationDiffsByIdErrors, DeleteComputeAllocationDiffsByIdResponses, DeleteComputeAllocationMembershipResourceOverr [...]
+import type { DeleteComputeAllocationChangeRequestEventsByIdData, DeleteComputeAllocationChangeRequestEventsByIdErrors, DeleteComputeAllocationChangeRequestEventsByIdResponses, DeleteComputeAllocationChangeRequestsByIdData, DeleteComputeAllocationChangeRequestsByIdErrors, DeleteComputeAllocationChangeRequestsByIdResponses, DeleteComputeAllocationDiffsByIdData, DeleteComputeAllocationDiffsByIdErrors, DeleteComputeAllocationDiffsByIdResponses, DeleteComputeAllocationMembershipResourceOverr [...]
 
 export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
     /**
@@ -660,6 +660,15 @@ export const getMe = <ThrowOnError extends boolean = false>(options?: Options<Ge
     ...options
 });
 
+/**
+ * List organizations (paginated)
+ */
+export const getOrganizations = <ThrowOnError extends boolean = false>(options?: Options<GetOrganizationsData, ThrowOnError>): RequestResult<GetOrganizationsResponses, unknown, ThrowOnError> => (options?.client ?? client).get<GetOrganizationsResponses, unknown, ThrowOnError>({
+    security: [{ name: 'Authorization', type: 'apiKey' }],
+    url: '/organizations',
+    ...options
+});
+
 /**
  * Create an organization
  */
@@ -920,6 +929,15 @@ export const getUserPrivileges = <ThrowOnError extends boolean = false>(options?
     ...options
 });
 
+/**
+ * List users (paginated)
+ */
+export const getUsers = <ThrowOnError extends boolean = false>(options?: Options<GetUsersData, ThrowOnError>): RequestResult<GetUsersResponses, unknown, ThrowOnError> => (options?.client ?? client).get<GetUsersResponses, unknown, ThrowOnError>({
+    security: [{ name: 'Authorization', type: 'apiKey' }],
+    url: '/users',
+    ...options
+});
+
 /**
  * Create a user
  */
diff --git a/web/src/generated/core/types.gen.ts b/web/src/generated/core/types.gen.ts
index 8cb68defa..69ca89d0a 100644
--- a/web/src/generated/core/types.gen.ts
+++ b/web/src/generated/core/types.gen.ts
@@ -264,6 +264,11 @@ export type Organization = {
     originated_id?: string;
 };
 
+export type OrganizationListResponse = {
+    items?: Array<Organization>;
+    total?: number;
+};
+
 export type PrivilegeKey = 'core:clusters:read' | 'core:clusters:write' | 'core:allocations:read' | 'core:allocations:write' | 'core:projects:read' | 'core:projects:write' | 'core:users:read' | 'core:users:write' | 'core:organizations:read' | 'core:organizations:write' | 'core:traces:read' | 'core:privileges:grant' | 'core:roles:manage';
 
 export type Project = {
@@ -411,6 +416,11 @@ export type UserIdentity = {
     user_id?: string;
 };
 
+export type UserListResponse = {
+    items?: Array<User>;
+    total?: number;
+};
+
 export type UserPrivilege = {
     granted_at?: string;
     granted_by?: string;
@@ -2586,6 +2596,31 @@ export type GetMeResponses = {
 
 export type GetMeResponse = GetMeResponses[keyof GetMeResponses];
 
+export type GetOrganizationsData = {
+    body?: never;
+    path?: never;
+    query?: {
+        /**
+         * Page size
+         */
+        limit?: number;
+        /**
+         * Page offset
+         */
+        offset?: number;
+    };
+    url: '/organizations';
+};
+
+export type GetOrganizationsResponses = {
+    /**
+     * OK
+     */
+    200: OrganizationListResponse;
+};
+
+export type GetOrganizationsResponse = GetOrganizationsResponses[keyof GetOrganizationsResponses];
+
 export type PostOrganizationsData = {
     /**
      * Organization payload
@@ -3433,6 +3468,31 @@ export type GetUserPrivilegesResponses = {
 
 export type GetUserPrivilegesResponse = GetUserPrivilegesResponses[keyof GetUserPrivilegesResponses];
 
+export type GetUsersData = {
+    body?: never;
+    path?: never;
+    query?: {
+        /**
+         * Page size
+         */
+        limit?: number;
+        /**
+         * Page offset
+         */
+        offset?: number;
+    };
+    url: '/users';
+};
+
+export type GetUsersResponses = {
+    /**
+     * OK
+     */
+    200: UserListResponse;
+};
+
+export type GetUsersResponse = GetUsersResponses[keyof GetUsersResponses];
+
 export type PostUsersData = {
     /**
      * User payload
diff --git a/web/src/generated/core/zod.gen.ts b/web/src/generated/core/zod.gen.ts
index 31782854b..19ccd7926 100644
--- a/web/src/generated/core/zod.gen.ts
+++ b/web/src/generated/core/zod.gen.ts
@@ -175,6 +175,13 @@ export const zOrganization = z.object({
 
 export type organizationZodType = z.infer<typeof zOrganization>;
 
+export const zOrganizationListResponse = z.object({
+    items: z.array(zOrganization).optional(),
+    total: z.int().optional()
+});
+
+export type organizationListResponseZodType = z.infer<typeof zOrganizationListResponse>;
+
 export const zPrivilegeKey = z.enum([
     'core:clusters:read',
     'core:clusters:write',
@@ -387,6 +394,13 @@ export const zCallerProfileResponse = z.object({
 
 export type callerProfileResponseZodType = z.infer<typeof zCallerProfileResponse>;
 
+export const zUserListResponse = z.object({
+    items: z.array(zUser).optional(),
+    total: z.int().optional()
+});
+
+export type userListResponseZodType = z.infer<typeof zUserListResponse>;
+
 export const zAttachResourceRequest = z.object({
     compute_allocation_resource_id: z.string().optional(),
     resource_amount: z.int().optional(),
@@ -1037,6 +1051,16 @@ export const zGetComputeClustersByIdUsersByUserIdResponse = zComputeClusterUser;
  */
 export const zGetMeResponse = zCallerProfileResponse;
 
+export const zGetOrganizationsQuery = z.object({
+    limit: z.int().optional(),
+    offset: z.int().optional()
+});
+
+/**
+ * OK
+ */
+export const zGetOrganizationsResponse = zOrganizationListResponse;
+
 /**
  * Organization payload
  */
@@ -1286,6 +1310,16 @@ export const zGetUserPrivilegesResponse = z.object({
     privileges: z.array(zPrivilegeKey).optional()
 });
 
+export const zGetUsersQuery = z.object({
+    limit: z.int().optional(),
+    offset: z.int().optional()
+});
+
+/**
+ * OK
+ */
+export const zGetUsersResponse = zUserListResponse;
+
 /**
  * User payload
  */