Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

if private base, do not show workspace users

Fendy Heryantof69f8b07d601
diff --git a/packages/nocodb-sdk-v2/src/lib/Api.ts b/packages/nocodb-sdk-v2/src/lib/Api.ts
index bfd9de458a..f45a9df30a 100644
--- a/packages/nocodb-sdk-v2/src/lib/Api.ts
+++ b/packages/nocodb-sdk-v2/src/lib/Api.ts
@@ -1281,7 +1281,7 @@ export interface WorkspaceUser {
* Email address of the user
* @format email
*/
- user_email: string;
+ email: string;
/** Unique identifier for the user */
user_id: string;
/**
@@ -1298,32 +1298,32 @@ export interface WorkspaceUser {
workspace_role: WorkspaceRoles;
}
-/** Request body for creating workspace users */
-export interface WorkspaceUserCreate {
- /** Unique identifier for the user (optional if user_email is provided) */
+/** Array of workspace users to be created. */
+export type WorkspaceUserCreate = {
+ /** Unique identifier for the user (optional if email is provided) */
user_id?: string;
/**
* Email address of the user (optional if user_id is provided)
* @format email
*/
- user_email?: string;
+ email?: string;
/** Workspace role to assign to the user */
workspace_role: WorkspaceRoles;
-}
+}[];
-/** Request body for updating workspace users */
-export interface WorkspaceUserUpdate {
+/** Array of workspace user updates. */
+export type WorkspaceUserUpdate = {
/** Unique identifier for the user */
- user_id?: string;
+ user_id: string;
/** New workspace role to assign to the user */
workspace_role: WorkspaceRoles;
-}
+}[];
-/** Request body for deleting workspace users */
-export interface WorkspaceUserDelete {
+/** Array of workspace users to be deleted. */
+export type WorkspaceUserDelete = {
/** Unique identifier for the user */
user_id: string;
-}
+}[];
type BaseFieldOptionsButton = object;
@@ -1555,14 +1555,14 @@ export class InternalApi<
}),
/**
- * @description Retrieve metadata for a specific workspace. Optionally include workspace members.
+ * @description Retrieves metadata for a specified workspace, with an option to include its members. Notes: - To include member details, use the query parameter `include[]=members`. - Workspace collaboration APIs are available only with self-hosted Enterprise plans and cloud-hosted Business+ plans.
*
- * @tags Workspaces
- * @name WorkspaceRead
+ * @tags Workspace Members
+ * @name WorkspaceMembersRead
* @summary Get workspace metadata
- * @request GET:/api/v3/meta/workspaces/{workspaceId}
+ * @request GET:/api/v3/meta/workspaces/{workspaceId}?include[]=members
*/
- workspaceRead: (
+ workspaceMembersRead: (
workspaceId: string,
query?: {
/**
@@ -1574,7 +1574,7 @@ export class InternalApi<
params: RequestParams = {},
) =>
this.request<Workspace | WorkspaceWithMembers, void>({
- path: `/api/v3/meta/workspaces/${workspaceId}`,
+ path: `/api/v3/meta/workspaces/${workspaceId}?include[]=members`,
method: 'GET',
query: query,
format: 'json',
@@ -1582,29 +1582,7 @@ export class InternalApi<
}),
/**
- * @description Retrieve a list of members associated with a specific workspace.
- *
- * @tags Workspace Members
- * @name WorkspaceMembersList
- * @summary List workspace members
- * @request GET:/api/v3/meta/workspaces/{workspaceId}/members
- */
- workspaceMembersList: (workspaceId: string, params: RequestParams = {}) =>
- this.request<
- {
- /** List of workspace members. */
- list?: WorkspaceUser[];
- },
- void
- >({
- path: `/api/v3/meta/workspaces/${workspaceId}/members`,
- method: 'GET',
- format: 'json',
- ...params,
- }),
-
- /**
- * @description Add new members to a workspace. The request requires the workspace identifier in the path and member details in the request body.
+ * @description Add new members to a workspace. The request requires the workspace identifier in the path and member details in the request body. Notes: Workspace collaboration APIs are available only with self-hosted Enterprise plans and cloud-hosted Business+ plans.
*
* @tags Workspace Members
* @name WorkspaceMembersInvite
@@ -1613,7 +1591,7 @@ export class InternalApi<
*/
workspaceMembersInvite: (
workspaceId: string,
- data: WorkspaceUserCreate | WorkspaceUserCreate[],
+ data: WorkspaceUserCreate,
params: RequestParams = {},
) =>
this.request<WorkspaceUser[], void>({
@@ -1626,7 +1604,7 @@ export class InternalApi<
}),
/**
- * @description Update roles of existing workspace members. The request requires the workspace identifier in the path and member update details in the request body.
+ * @description Update roles of existing workspace members. The request requires the workspace identifier in the path and member update details in the request body. Notes: Workspace collaboration APIs are available only with self-hosted Enterprise plans and cloud-hosted Business+ plans.
*
* @tags Workspace Members
* @name WorkspaceMembersUpdate
@@ -1635,7 +1613,7 @@ export class InternalApi<
*/
workspaceMembersUpdate: (
workspaceId: string,
- data: WorkspaceUserUpdate | WorkspaceUserUpdate[],
+ data: WorkspaceUserUpdate,
params: RequestParams = {},
) =>
this.request<WorkspaceUser[], void>({
@@ -1648,7 +1626,7 @@ export class InternalApi<
}),
/**
- * @description Remove members from a workspace. The request requires the workspace identifier in the path and member details in the request body.
+ * @description Remove members from a workspace. The request requires the workspace identifier in the path and member details in the request body. Notes: Workspace collaboration APIs are available only with self-hosted Enterprise plans and cloud-hosted Business+ plans.
*
* @tags Workspace Members
* @name WorkspaceMembersDelete
@@ -1657,7 +1635,7 @@ export class InternalApi<
*/
workspaceMembersDelete: (
workspaceId: string,
- data: WorkspaceUserDelete | WorkspaceUserDelete[],
+ data: WorkspaceUserDelete,
params: RequestParams = {},
) =>
this.request<
@@ -2123,7 +2101,7 @@ export class InternalApi<
}),
/**
- * @description Retrieve all details of a specific base, including its members.
+ * @description Retrieve all details of a specific base, including its members. Notes: Base collaboration APIs are available only with self-hosted Enterprise plans and cloud-hosted Business+ plans.
*
* @tags Base Users
* @name BaseUsersList
@@ -2139,7 +2117,7 @@ export class InternalApi<
}),
/**
- * @description Invite new users to a specific base using their User ID or Email address.
+ * @description Invite new users to a specific base using their User ID or Email address. Notes: Base collaboration APIs are available only with self-hosted Enterprise plans and cloud-hosted Business+ plans.
*
* @tags Base Users
* @name BaseUsersInvite
@@ -2161,7 +2139,7 @@ export class InternalApi<
}),
/**
- * @description Update roles for existing users in a base.
+ * @description Update roles for existing users in a base. Notes: Base collaboration APIs are available only with self-hosted Enterprise plans and cloud-hosted Business+ plans.
*
* @tags Base Users
* @name BaseUsersUpdate
@@ -2183,7 +2161,7 @@ export class InternalApi<
}),
/**
- * @description Remove users from a specific base using their IDs.
+ * @description Remove users from a specific base using their IDs. Notes: Base collaboration APIs are available only with self-hosted Enterprise plans and cloud-hosted Business+ plans.
*
* @tags Base Users
* @name BaseUsersDelete
diff --git a/packages/nocodb/src/services/v3/bases-v3.service.ts b/packages/nocodb/src/services/v3/bases-v3.service.ts
index 24e1f66f8f..8c0b0cbb26 100644
--- a/packages/nocodb/src/services/v3/bases-v3.service.ts
+++ b/packages/nocodb/src/services/v3/bases-v3.service.ts
@@ -93,6 +93,7 @@ export class BasesV3Service {
...(param.qsInclude?.includes('members')
? await this.baseMemberHelpers.getBaseMember(context, {
baseId: param.baseId,
+ isPrivateBase: base.default_role === 'no-access',
})
: {}),
} as BaseV3Type;
diff --git a/packages/nocodb/src/services/v3/members/base-member-helpers.ts b/packages/nocodb/src/services/v3/members/base-member-helpers.ts
index ebd00b4acf..1c4d282ce8 100644
--- a/packages/nocodb/src/services/v3/members/base-member-helpers.ts
+++ b/packages/nocodb/src/services/v3/members/base-member-helpers.ts
@@ -9,6 +9,7 @@ export class BaseMemberHelpers {
context: NcContext,
_param: {
baseId: string;
+ isPrivateBase?: boolean;
},
_ncMeta?: MetaService,
): Promise<{