public async Task <PersonEntryFixed> DeactivateUser([FromRoute] string userId) { return(await _alfrescoHttpClient.UpdatePerson(userId, new PersonBodyUpdate { Enabled = false })); }
public async Task ChangePassword([FromBody] UserPasswordModel body) { await _alfrescoHttpClient.UpdatePerson(AlfrescoNames.Aliases.Me, new PersonBodyUpdate { OldPassword = body.OldPassword, Password = body.NewPassword }); }
private async Task CheckCreateUser(UserARM user) { if (user.Body == null) { return; } string userId = null; var updatePropertes = false; try { var userProperties = user.Body.Properties?.As <JObject>()?.ToDictionary(); if (userProperties == null) { userProperties = new Dictionary <string, object>(); } if (user.MainGroup != null) { userProperties.Add(SpisumNames.Properties.Group, user.MainGroup); } user.Body.Properties = userProperties; var userInfo = await _alfrescoHttpClient.GetPerson(user.Body.Id); userId = userInfo?.Entry?.Id; var properties = userInfo.Entry?.Properties?.As <JObject>()?.ToDictionary(); updatePropertes = needUpdateProperties(properties, userProperties); } catch { } if (userId == null) { try { await _alfrescoHttpClient.CreatePerson(user.Body); } catch (Exception ex) { Log.Error(ex, "CreatePerson Fail"); } } else if (updatePropertes) { try { await _alfrescoHttpClient.UpdatePerson(user.Body.Id, new PersonBodyUpdate { Properties = user.Body.Properties }); } catch (Exception ex) { Log.Error(ex, "UpdatePerson Fail"); } } await _initialUser.CheckCreateGroupAndAddPerson(user.Body.Id, $"{SpisumNames.Prefixes.UserGroup}{user.Body.Id}"); await _initialUser.CheckCreateGroupAndAddPerson(user.Body.Id, user.MainGroup); if (user.Groups?.Count > 0) { foreach (var group in user.Groups) { await _initialUser.CheckCreateGroupAndAddPerson(user.Body.Id, group); } } }