From 0865260a78c279c97dd6055410b96cadb0608a8b Mon Sep 17 00:00:00 2001 From: Alma Date: Thu, 10 Apr 2025 22:23:27 +0200 Subject: [PATCH] delete user leantime api 12 --- app/api/users/route.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/app/api/users/route.ts b/app/api/users/route.ts index 336073bc..5eaea69c 100644 --- a/app/api/users/route.ts +++ b/app/api/users/route.ts @@ -209,15 +209,6 @@ async function createLeantimeUser(userData: { roles: string[]; }): Promise<{ success: boolean; error?: string }> { try { - // Map Keycloak roles to Leantime roles - const getLeantimeRole = (roles: string[]) => { - if (roles.includes('admin')) return 'admin'; - if (roles.includes('teacher')) return 'manager'; - return 'user'; - }; - - const leantimeRole = getLeantimeRole(userData.roles); - const response = await fetch('https://agilite.slm-lab.net/api/jsonrpc', { method: 'POST', headers: { @@ -233,7 +224,7 @@ async function createLeantimeUser(userData: { '0': 0, // This will be set by Leantime '1': userData.lastName, '2': userData.firstName, - '3': leantimeRole, + '3': '20', // Default role '4': '', // profileId '5': 'a', // status '6': userData.email, @@ -246,7 +237,7 @@ async function createLeantimeUser(userData: { '13': new Date().toISOString(), // modified lastname: userData.lastName, firstname: userData.firstName, - role: leantimeRole, + role: '20', // Default role profileId: '', status: 'a', username: userData.email, @@ -257,7 +248,11 @@ async function createLeantimeUser(userData: { jobTitle: '', jobLevel: '', department: '', - modified: new Date().toISOString() + modified: new Date().toISOString(), + createdOn: new Date().toISOString(), + source: 'keycloak', + notifications: 1, + settings: '{}' } } })