diff --git a/server/router/api/v1/idp_service.go b/server/router/api/v1/idp_service.go index d2cef0c51..70996672e 100644 --- a/server/router/api/v1/idp_service.go +++ b/server/router/api/v1/idp_service.go @@ -78,6 +78,8 @@ func (s *APIV1Service) UpdateIdentityProvider(ctx context.Context, request *v1pb switch field { case "title": update.Name = &request.IdentityProvider.Title + case "identifier_filter": + update.IdentifierFilter = &request.IdentityProvider.IdentifierFilter case "config": update.Config = convertIdentityProviderConfigToStore(request.IdentityProvider.Type, request.IdentityProvider.Config) } diff --git a/server/router/api/v1/memo_service.go b/server/router/api/v1/memo_service.go index c3ec13945..f813d5098 100644 --- a/server/router/api/v1/memo_service.go +++ b/server/router/api/v1/memo_service.go @@ -1057,23 +1057,6 @@ func getMemoPropertyFromContent(content string) (*storepb.MemoPayload_Property, return property, nil } -func ExtractTagsFromContent(content string) ([]string, error) { - nodes, err := parser.Parse(tokenizer.Tokenize(content)) - if err != nil { - return nil, errors.Wrap(err, "failed to parse content") - } - tags := []string{} - TraverseASTNodes(nodes, func(node ast.Node) { - if tagNode, ok := node.(*ast.Tag); ok { - tag := tagNode.Content - if !slices.Contains(tags, tag) { - tags = append(tags, tag) - } - } - }) - return tags, nil -} - func TraverseASTNodes(nodes []ast.Node, fn func(ast.Node)) { for _, node := range nodes { fn(node) diff --git a/store/idp.go b/store/idp.go index e5608e577..6aed4bbf4 100644 --- a/store/idp.go +++ b/store/idp.go @@ -62,6 +62,7 @@ func (s *Store) ListIdentityProviders(ctx context.Context, find *FindIdentityPro if err != nil { return nil, err } + identityProviders = append(identityProviders, identityProvider) s.idpCache.Store(identityProvider.Id, identityProvider) } return identityProviders, nil diff --git a/web/src/components/CreateIdentityProviderDialog.tsx b/web/src/components/CreateIdentityProviderDialog.tsx index ee6c88b0a..603387cdb 100644 --- a/web/src/components/CreateIdentityProviderDialog.tsx +++ b/web/src/components/CreateIdentityProviderDialog.tsx @@ -105,7 +105,7 @@ const CreateIdentityProviderDialog: React.FC = (props: Props) => { const identityProviderTypes = [...new Set(templateList.map((t) => t.type))]; const { confirmCallback, destroy, identityProvider } = props; const [basicInfo, setBasicInfo] = useState({ - name: "", + title: "", identifierFilter: "", }); const [type, setType] = useState(IdentityProvider_Type.OAUTH2); @@ -129,7 +129,7 @@ const CreateIdentityProviderDialog: React.FC = (props: Props) => { useEffect(() => { if (identityProvider) { setBasicInfo({ - name: identityProvider.name, + title: identityProvider.title, identifierFilter: identityProvider.identifierFilter, }); setType(identityProvider.type); @@ -149,7 +149,7 @@ const CreateIdentityProviderDialog: React.FC = (props: Props) => { const template = templateList.find((t) => t.title === selectedTemplate); if (template) { setBasicInfo({ - name: template.name, + title: template.title, identifierFilter: template.identifierFilter, }); setType(template.type); @@ -166,7 +166,7 @@ const CreateIdentityProviderDialog: React.FC = (props: Props) => { }; const allowConfirmAction = () => { - if (basicInfo.name === "") { + if (basicInfo.title === "") { return false; } if (type === "OAUTH2") { @@ -205,11 +205,12 @@ const CreateIdentityProviderDialog: React.FC = (props: Props) => { }, }, }); - toast.success(t("setting.sso-section.sso-created", { name: basicInfo.name })); + toast.success(t("setting.sso-section.sso-created", { name: basicInfo.title })); } else { await identityProviderServiceClient.updateIdentityProvider({ identityProvider: { ...basicInfo, + name: identityProvider!.name, type: type, config: { oauth2Config: { @@ -218,9 +219,9 @@ const CreateIdentityProviderDialog: React.FC = (props: Props) => { }, }, }, - updateMask: ["title", "identifierFilter", "config"], + updateMask: ["title", "identifier_filter", "config"], }); - toast.success(t("setting.sso-section.sso-updated", { name: basicInfo.name })); + toast.success(t("setting.sso-section.sso-updated", { name: basicInfo.title })); } } catch (error: any) { console.error(error); @@ -280,11 +281,11 @@ const CreateIdentityProviderDialog: React.FC = (props: Props) => { setBasicInfo({ ...basicInfo, - name: e.target.value, + title: e.target.value, }) } fullWidth diff --git a/web/src/components/Settings/SSOSection.tsx b/web/src/components/Settings/SSOSection.tsx index 8470f2cdf..0a45a538e 100644 --- a/web/src/components/Settings/SSOSection.tsx +++ b/web/src/components/Settings/SSOSection.tsx @@ -24,7 +24,7 @@ const SSOSection = () => { }; const handleDeleteIdentityProvider = async (identityProvider: IdentityProvider) => { - const content = t("setting.sso-section.confirm-delete", { name: identityProvider.name }); + const content = t("setting.sso-section.confirm-delete", { name: identityProvider.title }); showCommonDialog({ title: t("setting.sso-section.delete-sso"), diff --git a/web/src/pages/SignIn.tsx b/web/src/pages/SignIn.tsx index 19434d3c2..4b9cd3729 100644 --- a/web/src/pages/SignIn.tsx +++ b/web/src/pages/SignIn.tsx @@ -191,7 +191,7 @@ const SignIn = () => { size="md" onClick={() => handleSignInWithIdentityProvider(identityProvider)} > - {t("common.sign-in-with", { provider: identityProvider.name })} + {t("common.sign-in-with", { provider: identityProvider.title })} ))}