Removed setUserLockout from PartnerUI
This commit is contained in:
@@ -1585,13 +1585,7 @@ export const deleteUserClaim = async (targetUserId: string, claimId: string | nu
|
||||
await apiClient.delete(`/v1/api/users/${targetUserId}/claims/${claimId}`);
|
||||
};
|
||||
|
||||
export const forceLogoutUser = async (userId: string): Promise<void> => {
|
||||
await apiClient.put(`/v1/api/users/${userId}/session/logout`);
|
||||
};
|
||||
|
||||
export const setUserLockout = async (userId: string, disable: boolean): Promise<void> => {
|
||||
await apiClient.put(`/v1/api/users/${userId}/session/lockout/${disable}`);
|
||||
};
|
||||
// Administrative functions (forceLogoutUser, setUserLockout) removed from PartnerUI
|
||||
|
||||
import {
|
||||
syncUserAccount,
|
||||
|
||||
@@ -189,19 +189,7 @@ async function executeBackendSync(
|
||||
userSub?: string,
|
||||
profile?: UserSyncProfile
|
||||
): Promise<{ endpoint: string; data?: any }> {
|
||||
const rawTenantId = profile?.tenant_id ?? (profile as any)?.tenantId;
|
||||
const parsedTenantId =
|
||||
rawTenantId !== undefined && rawTenantId !== null && rawTenantId !== ''
|
||||
? Number(rawTenantId)
|
||||
: undefined;
|
||||
|
||||
const resolvedOrgId =
|
||||
parsedTenantId !== undefined
|
||||
? parsedTenantId
|
||||
: profile?.organisationId !== undefined && profile?.organisationId !== null && profile?.organisationId !== ''
|
||||
? Number(profile.organisationId)
|
||||
: undefined;
|
||||
|
||||
const endpoint = '/v1/api/integration/sync';
|
||||
const payload = {
|
||||
id: userSub || profile?.id || profile?.sub,
|
||||
sub: userSub || profile?.sub,
|
||||
@@ -209,40 +197,25 @@ async function executeBackendSync(
|
||||
name: profile?.name || undefined,
|
||||
role: profile?.role || undefined,
|
||||
tenant: profile?.tenant || undefined,
|
||||
tenant_id: parsedTenantId,
|
||||
organisationId: resolvedOrgId,
|
||||
tenant_id: profile?.tenant_id,
|
||||
organisationId: profile?.organisationId,
|
||||
};
|
||||
|
||||
let lastError: any = null;
|
||||
|
||||
for (const endpoint of USER_SYNC_CANDIDATE_ENDPOINTS) {
|
||||
try {
|
||||
let res;
|
||||
if (endpoint === '/v1/api/integration/sync') {
|
||||
try {
|
||||
res = await apiClient.post(endpoint, payload);
|
||||
} catch (postErr: any) {
|
||||
const errStatus = postErr?.response?.status;
|
||||
if (errStatus === 400 || errStatus === 415 || errStatus === 422) {
|
||||
res = await apiClient.post(endpoint, {});
|
||||
} else {
|
||||
throw postErr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = await apiClient.post(endpoint, payload);
|
||||
}
|
||||
return { endpoint, data: res?.data };
|
||||
} catch (err: any) {
|
||||
lastError = err;
|
||||
const status = err?.response?.status;
|
||||
if (status === 401 || status === 403 || status === 423) {
|
||||
try {
|
||||
const res = await apiClient.post(endpoint, payload);
|
||||
return { endpoint, data: res?.data };
|
||||
} catch (err: any) {
|
||||
const status = err?.response?.status;
|
||||
if (status === 400 || status === 415 || status === 422) {
|
||||
try {
|
||||
const resFallback = await apiClient.post(endpoint, {});
|
||||
return { endpoint, data: resFallback?.data };
|
||||
} catch (fallbackErr) {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
||||
throw lastError || new Error('Failed to reach user sync endpoint');
|
||||
}
|
||||
|
||||
export async function syncUserAccount(
|
||||
|
||||
Reference in New Issue
Block a user