delete user leantime api 12
This commit is contained in:
parent
42884c2934
commit
0865260a78
@ -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: '{}'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user