mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
bf45e97641
* Update types * fix circular dep * type imports * lint type imports and --fix
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import type { OAuthClient } from "@server/models";
|
|
|
|
/**
|
|
* Presents the OAuth client to the user, including the client secret.
|
|
* This should ONLY be used for admin users who need to manage the OAuth client.
|
|
*
|
|
* @param oauthClient The OAuth client to present
|
|
*/
|
|
export default function presentOAuthClient(oauthClient: OAuthClient) {
|
|
return {
|
|
id: oauthClient.id,
|
|
name: oauthClient.name,
|
|
description: oauthClient.description,
|
|
developerName: oauthClient.developerName,
|
|
developerUrl: oauthClient.developerUrl,
|
|
avatarUrl: oauthClient.avatarUrl,
|
|
clientId: oauthClient.clientId,
|
|
clientSecret: oauthClient.clientSecret,
|
|
clientType: oauthClient.clientType,
|
|
redirectUris: oauthClient.redirectUris,
|
|
published: oauthClient.published,
|
|
createdAt: oauthClient.createdAt,
|
|
updatedAt: oauthClient.updatedAt,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Important: This function is used to present the OAuth client to users
|
|
* that are NOT in the same workspace as the client. Be very careful about
|
|
* what you expose here.
|
|
*
|
|
* @param oauthClient The OAuth client to present
|
|
*/
|
|
export function presentPublishedOAuthClient(oauthClient: OAuthClient) {
|
|
return {
|
|
name: oauthClient.name,
|
|
description: oauthClient.description,
|
|
developerName: oauthClient.developerName,
|
|
developerUrl: oauthClient.developerUrl,
|
|
avatarUrl: oauthClient.avatarUrl,
|
|
clientId: oauthClient.clientId,
|
|
published: oauthClient.published,
|
|
};
|
|
}
|