mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[dev-crisj-ACA-3611]Refactor createUser method (#5872)
* Refactor createUser method * Fix linting
This commit is contained in:
@@ -53,7 +53,15 @@ export class UsersActions {
|
|||||||
password: user.password
|
password: user.password
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (e.status === 409) {
|
||||||
|
Logger.error('ACS user already created');
|
||||||
|
} else {
|
||||||
|
Logger.error('Not able to create ACS user: ' + JSON.stringify(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (this.api.apiService.isBpmConfiguration() || (this.api.apiService.isEcmBpmConfiguration())) {
|
if (this.api.apiService.isBpmConfiguration() || (this.api.apiService.isEcmBpmConfiguration())) {
|
||||||
Logger.log('Create user BPM');
|
Logger.log('Create user BPM');
|
||||||
if (user.tenantId) {
|
if (user.tenantId) {
|
||||||
@@ -65,16 +73,27 @@ export class UsersActions {
|
|||||||
user.id = apsUser.id;
|
user.id = apsUser.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
if (e.status === 409) {
|
||||||
|
Logger.error('BPM user already created');
|
||||||
|
} else {
|
||||||
|
Logger.error('Not able to create BPM user: ' + JSON.stringify(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (this.api.apiService.isOauthConfiguration()) {
|
if (this.api.apiService.isOauthConfiguration()) {
|
||||||
Logger.log('Create user identity');
|
Logger.log('Create user identity');
|
||||||
|
|
||||||
const identityUser = await this.identityService.createIdentityUser(user);
|
const identityUser = await this.identityService.createIdentityUser(user);
|
||||||
user.idIdentityService = identityUser.idIdentityService;
|
user.idIdentityService = identityUser.idIdentityService;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger.error('Error create user' + JSON.stringify(e));
|
if (e.status === 409) {
|
||||||
|
Logger.error('Identity user already created');
|
||||||
|
} else {
|
||||||
|
Logger.error('Not able to create identity user: ' + JSON.stringify(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
|
Reference in New Issue
Block a user