public AuthenticationModel GetSecurityModel() { IOptionsPlayIdentity identity = SessionHelper.GetIdentity(); if (identity == null) { return(null); } AuthenticationModel authenticationModel = new AuthenticationModel(); authenticationModel.Role = identity.Role; authenticationModel.Permissions = identity.Permissions.ToArray(); OptionsPlayFCUserIdentity fcUserIdentity = identity as OptionsPlayFCUserIdentity; if (fcUserIdentity != null) { authenticationModel.AccountNumber = fcUserIdentity.CustomerAccountCode; authenticationModel.AccountId = fcUserIdentity.AccountId; authenticationModel.UserName = fcUserIdentity.TradeAccountName; } //OptionsPlayWebUserIdentity webUserIdentity = identity as OptionsPlayWebUserIdentity; //if (webUserIdentity != null) //{ // authenticationModel.UserName = webUserIdentity.DisplayName; //} return(authenticationModel); }
public void UpdatePortfolio() { if (AreUserAndFunctionIsValid()) { OptionsPlayFCUserIdentity identity = FCIdentity; List <BasePortfolioItemGroupViewModel> result = _portfolioOrchestrator.GetPortfolioData( identity.CustomerCode, identity.CustomerAccountCode, identity.TradeAccount); List <string> connections = UserToConnectionMapper.GetConnectionIdsByUser(identity.UserId); Clients.Clients(connections).updatePortfolio(result); } }
public static OptionsPlayIdentity ToOptionsPlayIdentity(this AuthorizationCookieModel authorizationCookieModel) { OptionsPlayIdentity result; AuthCookieWebUserInfo cookieWebUserInfo = authorizationCookieModel.AdditionalInfo as AuthCookieWebUserInfo; if (cookieWebUserInfo != null) { //HACK: Just for testing purposes! //result = new OptionsPlayWebUserIdentity(cookieWebUserInfo.LoginName) //{ // DisplayName = cookieWebUserInfo.DisplayName, // UserId = authorizationCookieModel.UserId, // Role = (RoleCollection)authorizationCookieModel.Role, // RoleName = ((RoleCollection)authorizationCookieModel.Role).ToString(), // Permissions = authorizationCookieModel.Permissions.Cast<PermissionCollection>().ToList(), //}; //CUST_CODE: 109029901 //CUACCT_CODE: 109029906 //TRDACCT: A780361420 //Or //CUST_CODE: 109029910 //CUACCT_CODE: 109029922 //TRDACCT: A780370835 //123321 // 109029819 // 109029820 // A780738295 result = new OptionsPlayFCUserIdentity("108054788") { UserId = authorizationCookieModel.UserId, Role = RoleCollection.Admin, RoleName = RoleCollection.Admin.ToString(), Permissions = authorizationCookieModel.Permissions.Cast <PermissionCollection>().ToList(), CustomerCode = "108054788", CustomerAccountCode = "108054803", TradeAccount = "A780738295", InternalOrganization = 1099 }; } else { AuthCookieFCUserInfo authCookieFCUserInfo = (AuthCookieFCUserInfo)authorizationCookieModel.AdditionalInfo; result = new OptionsPlayFCUserIdentity(authCookieFCUserInfo.CustomerCode) { UserId = authorizationCookieModel.UserId, Role = (RoleCollection)authorizationCookieModel.Role, RoleName = ((RoleCollection)authorizationCookieModel.Role).ToString(), Permissions = authorizationCookieModel.Permissions.Cast <PermissionCollection>().ToList(), CustomerCode = authCookieFCUserInfo.CustomerCode, CustomerAccountCode = authCookieFCUserInfo.CustomerAccountCode, TradeAccount = authCookieFCUserInfo.TradeAccount, AccountId = authCookieFCUserInfo.AccountId, TradeAccountName = authCookieFCUserInfo.TradeAccountName, InternalOrganization = authCookieFCUserInfo.InternalOrganization }; } return(result); }