public IHttpActionResult SaveMembers(UIAccounts groupAccounts) { string mRetVal = "false"; Logger mLog = Logger.Instance(); MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditGroups", true)), AccountUtility.CurrentProfile()); if (!mSecurityInfo.MayEdit) { Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to add"); mLog.Error(mError); return(this.InternalServerError(mError)); } if (HttpContext.Current.Items["EditId"] == null || HttpContext.Current.Items["EditId"].ToString().ToLowerInvariant() != groupAccounts.SeqId.ToString().ToLowerInvariant()) { Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!"); mLog.Error(mError); return(this.InternalServerError(mError)); } MAccountProfile accountProfile = AccountUtility.CurrentProfile(); MClientChoicesState mClientChoicesState = ClientChoicesUtility.GetClientChoicesState(accountProfile.Account); MGroupRoles mProfile = new MGroupRoles(); mProfile.SecurityEntityId = SecurityEntityUtility.CurrentProfile().Id; mProfile.GroupSeqId = groupAccounts.SeqId; mProfile.Roles = String.Join(",", groupAccounts.Accounts); mProfile.AddedUpdatedBy = accountProfile.Id; GroupUtility.UpdateGroupRoles(mProfile); return(Ok(mRetVal)); }
public IHttpActionResult SaveMembers(UIAccounts roleAccounts) { string mRetVal = "false"; Logger mLog = Logger.Instance(); MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditRoles", true)), AccountUtility.CurrentProfile()); if (!mSecurityInfo.MayEdit) { Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to add"); mLog.Error(mError); return(this.InternalServerError(mError)); } if (HttpContext.Current.Items["EditId"] == null) { Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!"); mLog.Error(mError); return(this.InternalServerError(mError)); } MAccountProfile accountProfile = AccountUtility.CurrentProfile(); MClientChoicesState mClientChoicesState = ClientChoicesUtility.GetClientChoicesState(accountProfile.Account); bool success = RoleUtility.UpdateAllAccountsForRole(roleAccounts.SeqId, int.Parse(mClientChoicesState[MClientChoices.SecurityEntityId]), roleAccounts.Accounts, accountProfile.Id); return(Ok(mRetVal)); }