mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Point getAppsGitLab method to self-hosted GitLab instance if applicable, fix integration revocation issue related to missing metadata param partly
This commit is contained in:
@@ -160,7 +160,7 @@ export const getIntegrationAuthAccessHelper = async ({
|
|||||||
let accessId;
|
let accessId;
|
||||||
let accessToken;
|
let accessToken;
|
||||||
const integrationAuth = await IntegrationAuth.findById(integrationAuthId).select(
|
const integrationAuth = await IntegrationAuth.findById(integrationAuthId).select(
|
||||||
"workspace integration +accessCiphertext +accessIV +accessTag +accessExpiresAt +refreshCiphertext +refreshIV +refreshTag +accessIdCiphertext +accessIdIV +accessIdTag"
|
"workspace integration +accessCiphertext +accessIV +accessTag +accessExpiresAt +refreshCiphertext +refreshIV +refreshTag +accessIdCiphertext +accessIdIV +accessIdTag metadata"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!integrationAuth)
|
if (!integrationAuth)
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ const getApps = async ({
|
|||||||
break;
|
break;
|
||||||
case INTEGRATION_GITLAB:
|
case INTEGRATION_GITLAB:
|
||||||
apps = await getAppsGitlab({
|
apps = await getAppsGitlab({
|
||||||
|
integrationAuth,
|
||||||
accessToken,
|
accessToken,
|
||||||
teamId,
|
teamId,
|
||||||
});
|
});
|
||||||
@@ -736,12 +737,16 @@ const getAppsTerraformCloud = async ({
|
|||||||
* @returns {String} apps.name - name of GitLab site
|
* @returns {String} apps.name - name of GitLab site
|
||||||
*/
|
*/
|
||||||
const getAppsGitlab = async ({
|
const getAppsGitlab = async ({
|
||||||
|
integrationAuth,
|
||||||
accessToken,
|
accessToken,
|
||||||
teamId,
|
teamId,
|
||||||
}: {
|
}: {
|
||||||
|
integrationAuth: IIntegrationAuth;
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
teamId?: string;
|
teamId?: string;
|
||||||
}) => {
|
}) => {
|
||||||
|
const gitLabApiUrl = integrationAuth.url ? `${integrationAuth.url}/api` : INTEGRATION_GITLAB_API_URL;
|
||||||
|
|
||||||
const apps: App[] = [];
|
const apps: App[] = [];
|
||||||
|
|
||||||
let page = 1;
|
let page = 1;
|
||||||
@@ -758,7 +763,7 @@ const getAppsGitlab = async ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { data } = await standardRequest.get(
|
const { data } = await standardRequest.get(
|
||||||
`${INTEGRATION_GITLAB_API_URL}/v4/groups/${teamId}/projects`,
|
`${gitLabApiUrl}/v4/groups/${teamId}/projects`,
|
||||||
{
|
{
|
||||||
params,
|
params,
|
||||||
headers: {
|
headers: {
|
||||||
@@ -785,7 +790,7 @@ const getAppsGitlab = async ({
|
|||||||
// case: fetch projects for individual in GitLab
|
// case: fetch projects for individual in GitLab
|
||||||
|
|
||||||
const { id } = (
|
const { id } = (
|
||||||
await standardRequest.get(`${INTEGRATION_GITLAB_API_URL}/v4/user`, {
|
await standardRequest.get(`${gitLabApiUrl}/v4/user`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${accessToken}`,
|
Authorization: `Bearer ${accessToken}`,
|
||||||
"Accept-Encoding": "application/json",
|
"Accept-Encoding": "application/json",
|
||||||
@@ -800,7 +805,7 @@ const getAppsGitlab = async ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { data } = await standardRequest.get(
|
const { data } = await standardRequest.get(
|
||||||
`${INTEGRATION_GITLAB_API_URL}/v4/users/${id}/projects`,
|
`${gitLabApiUrl}/v4/users/${id}/projects`,
|
||||||
{
|
{
|
||||||
params,
|
params,
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ export const validateClientForIntegration = async ({
|
|||||||
if (!integration) throw IntegrationNotFoundError();
|
if (!integration) throw IntegrationNotFoundError();
|
||||||
|
|
||||||
const integrationAuth = await IntegrationAuth.findById(integration.integrationAuth).select(
|
const integrationAuth = await IntegrationAuth.findById(integration.integrationAuth).select(
|
||||||
"+refreshCiphertext +refreshIV +refreshTag +accessCiphertext +accessIV +accessTag +accessExpiresAt"
|
"+refreshCiphertext +refreshIV +refreshTag +accessCiphertext +accessIV +accessTag +accessExpiresAt +metadata"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!integrationAuth) throw IntegrationAuthNotFoundError();
|
if (!integrationAuth) throw IntegrationAuthNotFoundError();
|
||||||
|
|
||||||
const accessToken = (
|
const accessToken = (
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ const validateClientForIntegrationAuth = async ({
|
|||||||
const integrationAuth = await IntegrationAuth.findById(integrationAuthId)
|
const integrationAuth = await IntegrationAuth.findById(integrationAuthId)
|
||||||
.populate<{ workspace: IWorkspace }>("workspace")
|
.populate<{ workspace: IWorkspace }>("workspace")
|
||||||
.select(
|
.select(
|
||||||
"+refreshCiphertext +refreshIV +refreshTag +accessCiphertext +accessIV +accessTag +accessExpiresAt"
|
"+refreshCiphertext +refreshIV +refreshTag +accessCiphertext +accessIV +accessTag +accessExpiresAt +metadata"
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!integrationAuth) throw IntegrationAuthNotFoundError();
|
if (!integrationAuth) throw IntegrationAuthNotFoundError();
|
||||||
|
|
||||||
let accessToken, accessId;
|
let accessToken, accessId;
|
||||||
|
|||||||
Reference in New Issue
Block a user