public Task <Identity> UpdateIdentityAsync(string apiVersion, string name, UpdateIdentity updateinfo) { if (this.identities.ContainsKey(name) == false) { throw new InvalidOperationException("Module not found"); } if (string.IsNullOrEmpty(updateinfo.GenerationId)) { throw new InvalidOperationException("Generation ID not specified"); } var newIdentity = new Identity { ModuleId = name, ManagedBy = updateinfo.ManagedBy, GenerationId = updateinfo.GenerationId }; return(Task.FromResult( this.identities.AddOrUpdate( name, newIdentity, (n, v) => newIdentity))); }
/// <summary> /// Creates an identity wrapper over the on-the-wire identity. /// </summary> /// <param name="identity"></param> internal Identity(UpdateIdentity identity) { // Save the original Guid ID and revision Raw = identity; GenerateQuickLookupKeys(); }
public async Task <IActionResult> UpdateRole([FromBody] UpdateIdentity objUpdateIdentity) { try { PayoutRole payoutRole = await _roleManager.FindByNameAsync(objUpdateIdentity.id); PropertyInfo prop = payoutRole.GetType().GetProperty(objUpdateIdentity.colName, BindingFlags.Public | BindingFlags.Instance); if (null != prop && prop.CanWrite) { prop.SetValue(payoutRole, objUpdateIdentity.colValue, null); } //payoutRole.IsDisabled = true; var resultUpd = await _roleManager.UpdateAsync(payoutRole); if (resultUpd.Succeeded) { return(Ok(resultUpd)); } foreach (var error in resultUpd.Errors) { ModelState.AddModelError("error", error.Description); } } catch (Exception ex) { _logger.LogError($"error while updating Role: {ex}"); return(StatusCode((int)HttpStatusCode.InternalServerError, "error while updating Role: " + ex.Message)); } return(BadRequest()); }
/// <summary> /// Initialize an update identity from GUID and revision /// </summary> /// <param name="id">Update GUID</param> /// <param name="revision">Update revision</param> public Identity(Guid id, int revision) { Raw = new UpdateIdentity() { UpdateID = id, RevisionNumber = revision }; GenerateQuickLookupKeys(); }
//public async Task<IActionResult> UpdateUser([FromBody] UpdateIdentity objUpdateIdentity) public IActionResult UpdateUser([FromBody] UpdateIdentity objUpdateIdentity) { try { PayoutUser payoutUser = _userManager.FindByEmailAsync(objUpdateIdentity.id).Result; PropertyInfo prop = payoutUser.GetType().GetProperty(objUpdateIdentity.colName, BindingFlags.Public | BindingFlags.Instance); if (null != prop && prop.CanWrite) { prop.SetValue(payoutUser, objUpdateIdentity.colValue, null); } dynamic resultUpd = null; if (objUpdateIdentity.colName == "IsOkta") //First updates Okta groups if Col is Okta checkbox { resultUpd = ChangeOktaUserGroups(objUpdateIdentity.id, objUpdateIdentity.colValue); } if (resultUpd == null || ((StatusCodeResult)resultUpd).StatusCode != 400) //Then updates RS Database { resultUpd = _userManager.UpdateAsync(payoutUser).Result; if (resultUpd.Succeeded) { return(Ok(resultUpd)); } } //foreach (var error in resultUpd.Errors) //{ // ModelState.AddModelError("error", error.Description); //} } catch (Exception ex) { _logger.LogError($"error while updating User: {ex}"); return(StatusCode((int)HttpStatusCode.InternalServerError, "error while updating User: " + ex.Message)); } return(BadRequest()); }
public System.Threading.Tasks.Task <Identity> UpdateIdentity(string api_version, string name, [Microsoft.AspNetCore.Mvc.FromBody] UpdateIdentity updateinfo) { return(_implementation.UpdateIdentityAsync(api_version, name, updateinfo)); }