Skip to content

Commit

Permalink
fix AuthProviderService.createAuthProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
geropl committed Nov 15, 2023
1 parent 990cf8c commit 4c03454
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions components/server/src/api/auth-provider-service-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ export class AuthProviderServiceAPI implements ServiceImpl<typeof AuthProviderSe
request: CreateAuthProviderRequest,
_: HandlerContext,
): Promise<CreateAuthProviderResponse> {
const ownerId = request.owner.case === "ownerId" ? request.owner.value : "";
const organizationId = request.owner.case === "organizationId" ? request.owner.value : "";

if (!uuidValidate(organizationId) && !uuidValidate(ownerId)) {
throw new ConnectError("organizationId or ownerId is required", Code.InvalidArgument);
}

if (organizationId) {
if (!uuidValidate(organizationId)) {
throw new ConnectError("organizationId is required", Code.InvalidArgument);
}

const result = await this.authProviderService.createOrgAuthProvider(ctxUserId(), {
organizationId,
host: request.host,
Expand Down Expand Up @@ -87,10 +86,7 @@ export class AuthProviderServiceAPI implements ServiceImpl<typeof AuthProviderSe
});
}

async listAuthProviders(
request: ListAuthProvidersRequest,
_: HandlerContext,
): Promise<ListAuthProvidersResponse> {
async listAuthProviders(request: ListAuthProvidersRequest, _: HandlerContext): Promise<ListAuthProvidersResponse> {
const target = request.id;
const ownerId = target.case === "userId" ? target.value : "";
const organizationId = target.case === "organizationId" ? target.value : "";
Expand Down

0 comments on commit 4c03454

Please sign in to comment.