From dc5e19f751c8a5a7aeea8658f90de8023aa133b1 Mon Sep 17 00:00:00 2001 From: X1Vi Date: Mon, 25 Nov 2024 22:16:09 +0530 Subject: [PATCH 1/3] fix #4144 now when there is no sso then the Disallow password auth is disabled --- proto/gen/apidocs.swagger.yaml | 248 +++++++++++++----- .../components/Settings/WorkspaceSection.tsx | 13 + 2 files changed, 201 insertions(+), 60 deletions(-) diff --git a/proto/gen/apidocs.swagger.yaml b/proto/gen/apidocs.swagger.yaml index b12b1f90be286..e2fade861c5ce 100644 --- a/proto/gen/apidocs.swagger.yaml +++ b/proto/gen/apidocs.swagger.yaml @@ -311,12 +311,16 @@ paths: type: integer format: int32 - name: pageToken - description: "A page token, received from a previous `ListMemos` call.\r\nProvide this to retrieve the subsequent page." + description: |- + A page token, received from a previous `ListMemos` call. + Provide this to retrieve the subsequent page. in: query required: false type: string - name: filter - description: "Filter is used to filter memos returned in the list.\r\nFormat: \"creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']\"" + description: |- + Filter is used to filter memos returned in the list. + Format: "creator == 'users/{uid}' && visibilities == ['PUBLIC', 'PROTECTED']" in: query required: false type: string @@ -505,7 +509,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: filter - description: "Filter is used to filter users returned in the list.\r\nFormat: \"username == 'frank'\"" + description: |- + Filter is used to filter users returned in the list. + Format: "username == 'frank'" in: query required: false type: string @@ -666,7 +672,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The resource name of the workspace setting.\r\nFormat: settings/{setting}" + description: |- + The resource name of the workspace setting. + Format: settings/{setting} in: path required: true type: string @@ -688,7 +696,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: setting.name - description: "name is the name of the setting.\r\nFormat: settings/{setting}" + description: |- + name is the name of the setting. + Format: settings/{setting} in: path required: true type: string @@ -724,7 +734,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: identityProvider.name - description: "The name of the identityProvider.\r\nFormat: identityProviders/{id}" + description: |- + The name of the identityProvider. + Format: identityProviders/{id} in: path required: true type: string @@ -762,7 +774,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: inbox.name - description: "The name of the inbox.\r\nFormat: inboxes/{id}" + description: |- + The name of the inbox. + Format: inboxes/{id} in: path required: true type: string @@ -806,7 +820,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: memo.name - description: "The name of the memo.\r\nFormat: memos/{id}\r\nid is the system generated id." + description: |- + The name of the memo. + Format: memos/{id} + id is the system generated id. in: path required: true type: string @@ -824,7 +841,9 @@ paths: $ref: '#/definitions/v1RowStatus' creator: type: string - title: "The name of the creator.\r\nFormat: users/{id}" + title: |- + The name of the creator. + Format: users/{id} createTime: type: string format: date-time @@ -871,7 +890,9 @@ paths: readOnly: true parent: type: string - title: "The name of the parent memo.\r\nFormat: memos/{id}" + title: |- + The name of the parent memo. + Format: memos/{id} readOnly: true snippet: type: string @@ -897,7 +918,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_1 - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -919,7 +942,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_1 - description: "The name of the identityProvider to delete.\r\nFormat: identityProviders/{id}" + description: |- + The name of the identityProvider to delete. + Format: identityProviders/{id} in: path required: true type: string @@ -941,7 +966,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_2 - description: "The name of the identityProvider to get.\r\nFormat: identityProviders/{id}" + description: |- + The name of the identityProvider to get. + Format: identityProviders/{id} in: path required: true type: string @@ -963,7 +990,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_2 - description: "The name of the inbox to delete.\r\nFormat: inboxes/{id}" + description: |- + The name of the inbox to delete. + Format: inboxes/{id} in: path required: true type: string @@ -985,7 +1014,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_3 - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -1007,7 +1039,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_3 - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -1029,7 +1064,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_4 - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1051,7 +1088,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name_4 - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1073,7 +1112,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the activity.\r\nFormat: activities/{id}" + description: |- + The name of the activity. + Format: activities/{id} in: path required: true type: string @@ -1095,7 +1136,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1117,7 +1160,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1138,7 +1183,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1166,7 +1213,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1193,7 +1242,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1214,7 +1265,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1241,7 +1294,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1262,7 +1317,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1289,7 +1346,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1311,7 +1370,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1338,7 +1399,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1360,7 +1423,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the memo.\r\nFormat: memos/{id}" + description: |- + The name of the memo. + Format: memos/{id} in: path required: true type: string @@ -1387,7 +1452,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1410,7 +1477,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: parent - description: "The parent, who owns the tags.\r\nFormat: memos/{id}. Use \"memos/-\" to delete all tags." + description: |- + The parent, who owns the tags. + Format: memos/{id}. Use "memos/-" to delete all tags. in: path required: true type: string @@ -1441,7 +1510,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: parent - description: "The parent, who owns the tags.\r\nFormat: memos/{id}. Use \"memos/-\" to rename all tags." + description: |- + The parent, who owns the tags. + Format: memos/{id}. Use "memos/-" to rename all tags. in: path required: true type: string @@ -1468,7 +1539,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: resource.name - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -1500,7 +1574,9 @@ paths: format: int64 memo: type: string - title: "The related memo.\r\nFormat: memos/{id}" + title: |- + The related memo. + Format: memos/{id} tags: - ResourceService /api/v1/{setting.name}: @@ -1518,7 +1594,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: setting.name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1557,7 +1635,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: user.name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1613,7 +1693,9 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the user.\r\nFormat: users/{id}" + description: |- + The name of the user. + Format: users/{id} in: path required: true type: string @@ -1646,7 +1728,10 @@ paths: $ref: '#/definitions/googlerpcStatus' parameters: - name: name - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. in: path required: true type: string @@ -1839,7 +1924,9 @@ definitions: properties: name: type: string - title: "The name of the identityProvider.\r\nFormat: identityProviders/{id}" + title: |- + The name of the identityProvider. + Format: identityProviders/{id} type: $ref: '#/definitions/apiv1IdentityProviderType' title: @@ -1875,7 +1962,10 @@ definitions: properties: name: type: string - description: "The name of the memo.\r\nFormat: memos/{id}\r\nid is the system generated id." + description: |- + The name of the memo. + Format: memos/{id} + id is the system generated id. uid: type: string description: The user defined id of the memo. @@ -1883,7 +1973,9 @@ definitions: $ref: '#/definitions/v1RowStatus' creator: type: string - title: "The name of the creator.\r\nFormat: users/{id}" + title: |- + The name of the creator. + Format: users/{id} createTime: type: string format: date-time @@ -1930,7 +2022,9 @@ definitions: readOnly: true parent: type: string - title: "The name of the parent memo.\r\nFormat: memos/{id}" + title: |- + The name of the parent memo. + Format: memos/{id} readOnly: true snippet: type: string @@ -1963,7 +2057,9 @@ definitions: properties: name: type: string - title: "The name of the user.\r\nFormat: users/{id}" + title: |- + The name of the user. + Format: users/{id} locale: type: string description: The preferred locale of the user. @@ -2007,7 +2103,10 @@ definitions: weekStartDayOffset: type: integer format: int32 - description: "week_start_day_offset is the week start day offset from Sunday.\r\n0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday\r\nDefault is Sunday." + description: |- + week_start_day_offset is the week start day offset from Sunday. + 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday + Default is Sunday. disallowChangeUsername: type: boolean description: disallow_change_username disallows changing username. @@ -2058,7 +2157,9 @@ definitions: properties: name: type: string - title: "name is the name of the setting.\r\nFormat: settings/{setting}" + title: |- + name is the name of the setting. + Format: settings/{setting} generalSetting: $ref: '#/definitions/apiv1WorkspaceGeneralSetting' storageSetting: @@ -2073,7 +2174,9 @@ definitions: description: storage_type is the storage type. filepathTemplate: type: string - title: "The template of file path.\r\ne.g. assets/{timestamp}_{filename}" + title: |- + The template of file path. + e.g. assets/{timestamp}_{filename} uploadSizeLimitMb: type: string format: int64 @@ -2232,7 +2335,9 @@ definitions: properties: name: type: string - title: "The name of the activity.\r\nFormat: activities/{id}" + title: |- + The name of the activity. + Format: activities/{id} creatorId: type: integer format: int32 @@ -2375,7 +2480,9 @@ definitions: properties: name: type: string - title: "The name of the inbox.\r\nFormat: inboxes/{id}" + title: |- + The name of the inbox. + Format: inboxes/{id} sender: type: string title: 'Format: users/{id}' @@ -2449,7 +2556,9 @@ definitions: $ref: '#/definitions/v1Inbox' nextPageToken: type: string - description: "A token, which can be sent as `page_token` to retrieve the next page.\r\nIf this field is omitted, there are no subsequent pages." + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. v1ListMemoCommentsResponse: type: object properties: @@ -2492,7 +2601,9 @@ definitions: $ref: '#/definitions/apiv1Memo' nextPageToken: type: string - description: "A token, which can be sent as `page_token` to retrieve the next page.\r\nIf this field is omitted, there are no subsequent pages." + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. v1ListNode: type: object properties: @@ -2568,10 +2679,14 @@ definitions: properties: memo: $ref: '#/definitions/v1MemoRelationMemo' - title: "The name of memo.\r\nFormat: \"memos/{uid}\"" + title: |- + The name of memo. + Format: "memos/{uid}" relatedMemo: $ref: '#/definitions/v1MemoRelationMemo' - title: "The name of related memo.\r\nFormat: \"memos/{uid}\"" + title: |- + The name of related memo. + Format: "memos/{uid}" type: $ref: '#/definitions/v1MemoRelationType' v1MemoRelationMemo: @@ -2579,7 +2694,9 @@ definitions: properties: name: type: string - title: "The name of the memo.\r\nFormat: memos/{id}" + title: |- + The name of the memo. + Format: memos/{id} uid: type: string snippet: @@ -2753,7 +2870,9 @@ definitions: format: int32 creator: type: string - title: "The name of the creator.\r\nFormat: users/{id}" + title: |- + The name of the creator. + Format: users/{id} contentId: type: string reactionType: @@ -2770,7 +2889,10 @@ definitions: properties: name: type: string - description: "The name of the resource.\r\nFormat: resources/{id}\r\nid is the system generated unique identifier." + description: |- + The name of the resource. + Format: resources/{id} + id is the system generated unique identifier. uid: type: string description: The user defined id of the resource. @@ -2792,7 +2914,9 @@ definitions: format: int64 memo: type: string - title: "The related memo.\r\nFormat: memos/{id}" + title: |- + The related memo. + Format: memos/{id} v1RestoreMarkdownNodesRequest: type: object properties: @@ -2914,7 +3038,9 @@ definitions: properties: name: type: string - title: "The name of the user.\r\nFormat: users/{id}" + title: |- + The name of the user. + Format: users/{id} id: type: integer format: int32 @@ -2988,7 +3114,9 @@ definitions: properties: owner: type: string - title: "The name of instance owner.\r\nFormat: \"users/{id}\"" + title: |- + The name of instance owner. + Format: "users/{id}" version: type: string title: version is the current version of instance diff --git a/web/src/components/Settings/WorkspaceSection.tsx b/web/src/components/Settings/WorkspaceSection.tsx index 7032532b189c6..44c1e0b6199fa 100644 --- a/web/src/components/Settings/WorkspaceSection.tsx +++ b/web/src/components/Settings/WorkspaceSection.tsx @@ -10,6 +10,7 @@ import { WorkspaceGeneralSetting } from "@/types/proto/api/v1/workspace_setting_ import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { useTranslate } from "@/utils/i18n"; import showUpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog"; +import { identityProviderServiceClient } from "@/grpcweb"; const WorkspaceSection = () => { const t = useTranslate(); @@ -18,6 +19,7 @@ const WorkspaceSection = () => { workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.GENERAL)?.generalSetting || {}, ); const [workspaceGeneralSetting, setWorkspaceGeneralSetting] = useState(originalSetting); + const [identityProviderList, setIdentityProviderList] = useState([]); useEffect(() => { setWorkspaceGeneralSetting(originalSetting); @@ -50,6 +52,16 @@ const WorkspaceSection = () => { toast.success(t("message.update-succeed")); }; + useEffect(() => { + fetchIdentityProviderList(); + }, []); + + const fetchIdentityProviderList = async () => { + const { identityProviders } = await identityProviderServiceClient.listIdentityProviders({}); + setIdentityProviderList(identityProviders); + }; + + return (

{t("common.basic")}

@@ -115,6 +127,7 @@ const WorkspaceSection = () => {
{t("setting.workspace-section.disallow-password-auth")} updatePartialSetting({ disallowPasswordAuth: event.target.checked })} /> From 9dcb419836cd092a60308c82d97a8577336d523d Mon Sep 17 00:00:00 2001 From: pransh62390 <63577123+pransh62390@users.noreply.github.com> Date: Mon, 25 Nov 2024 22:32:36 +0530 Subject: [PATCH 2/3] fixed the import issue --- web/src/components/Settings/WorkspaceSection.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/web/src/components/Settings/WorkspaceSection.tsx b/web/src/components/Settings/WorkspaceSection.tsx index 44c1e0b6199fa..20d8b102aae0a 100644 --- a/web/src/components/Settings/WorkspaceSection.tsx +++ b/web/src/components/Settings/WorkspaceSection.tsx @@ -11,6 +11,7 @@ import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { useTranslate } from "@/utils/i18n"; import showUpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog"; import { identityProviderServiceClient } from "@/grpcweb"; +import { IdentityProvider } from "@/types/proto/api/v1/idp_service"; const WorkspaceSection = () => { const t = useTranslate(); From db07567685e3f504c47cb753130fb4f3fccd3e88 Mon Sep 17 00:00:00 2001 From: X1Vi Date: Mon, 25 Nov 2024 23:31:50 +0530 Subject: [PATCH 3/3] attempt fixing linting issues --- web/src/components/Settings/WorkspaceSection.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/web/src/components/Settings/WorkspaceSection.tsx b/web/src/components/Settings/WorkspaceSection.tsx index 20d8b102aae0a..28b0910e3774d 100644 --- a/web/src/components/Settings/WorkspaceSection.tsx +++ b/web/src/components/Settings/WorkspaceSection.tsx @@ -5,13 +5,13 @@ import { ExternalLinkIcon } from "lucide-react"; import { useEffect, useState } from "react"; import { toast } from "react-hot-toast"; import { Link } from "react-router-dom"; +import { identityProviderServiceClient } from "@/grpcweb"; import { workspaceSettingNamePrefix, useWorkspaceSettingStore } from "@/store/v1"; +import { IdentityProvider } from "@/types/proto/api/v1/idp_service"; import { WorkspaceGeneralSetting } from "@/types/proto/api/v1/workspace_setting_service"; import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting"; import { useTranslate } from "@/utils/i18n"; import showUpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog"; -import { identityProviderServiceClient } from "@/grpcweb"; -import { IdentityProvider } from "@/types/proto/api/v1/idp_service"; const WorkspaceSection = () => { const t = useTranslate(); @@ -62,7 +62,6 @@ const WorkspaceSection = () => { setIdentityProviderList(identityProviders); }; - return (

{t("common.basic")}

@@ -128,7 +127,7 @@ const WorkspaceSection = () => {
{t("setting.workspace-section.disallow-password-auth")} updatePartialSetting({ disallowPasswordAuth: event.target.checked })} />