public LocalAppsRegistry(SharedContext shCtx) { _sharedContext = shCtx; }
public AttachmentFileRepo(SharedContext context, UserService userService) : base(context, userService) { _context = context; }
public CustomerAccess(SharedContext context, System.Security.Principal.IPrincipal LoggedInUser) : base(context) { Initialized = Init(LoggedInUser); }
public CustomerAccess(SharedContext context, int _UserId) : base(context) { Initialized = Init(_UserId); }
/// <summary> /// Returns a list of customers and dealerships that the given user Id has access to view. /// </summary> /// <param name="userId">ID of the user requesting the list of customers and dealerships</param> /// <returns>A dataset of customers and dealers that the given user id is allowed to view/edit</returns> public IEnumerable <CustomerDealershipDataSet> getCustomerAndDealershipList(long userId) { List <CustomerDealershipDataSet> returnData = new List <CustomerDealershipDataSet>(); using (var context = new SharedContext()) { List <UserAccessMaps> userAccessRecords = context.UserAccessMaps .Where(m => m.user_auto == userId) .OrderBy(m => m.AccessLevelTypeId) .ToList(); foreach (var accessRecord in userAccessRecords) { if (accessRecord.AccessLevelTypeId == (int)UserAccessTypes.GlobalAdministrator) { returnData.AddRange( context.Dealerships.OrderBy(d => d.Name).Select(d => new CustomerDealershipDataSet { id = d.DealershipId, type = "dealership", name = d.Name }) ); returnData.AddRange( context.CUSTOMER.OrderBy(c => c.cust_name).Select(c => new CustomerDealershipDataSet { id = c.customer_auto, type = "customer", name = c.cust_name }) ); return(returnData); } else if (accessRecord.AccessLevelTypeId == (int)UserAccessTypes.DealershipAdministrator) { returnData.AddRange( context.Dealerships.OrderBy(d => d.Name).Where(d => d.DealershipId == accessRecord.DealershipId).Select(d => new CustomerDealershipDataSet { id = d.DealershipId, type = "dealership", name = d.Name }) ); returnData.AddRange( context.CUSTOMER.OrderBy(c => c.cust_name).Where(c => c.DealershipId == accessRecord.DealershipId) .Select(c => new CustomerDealershipDataSet { id = c.customer_auto, type = "customer", name = c.cust_name }) ); } else if (accessRecord.AccessLevelTypeId == (int)UserAccessTypes.CustomerAdministrator) { returnData.Add( context.CUSTOMER.OrderBy(c => c.cust_name).Where(c => c.customer_auto == accessRecord.customer_auto) .Select(c => new CustomerDealershipDataSet { id = c.customer_auto, type = "customer", name = c.cust_name }).First() ); } } } return(returnData); }
public GETResponseMessage updateExistingUserAccount(long userId, string username, string email, int accessLevel) { UserTeam usersTeam = AuthorizeUserAccess.getUserTeam(userId); using (var context = new SharedContext()) { var userAccount = context.USER_TABLE.Find(userId); if (userAccount == null || username == "" || email == "") { return(new GETResponseMessage(ResponseTypes.InvalidInputs, "Invalid user details. ")); } var aspUserAccount = context.AspNetUsers.Find(userAccount.AspNetUserId); if (aspUserAccount == null) { return(new GETResponseMessage(ResponseTypes.InvalidInputs, "Internal error occurred!. AspUser not found!")); } if (email != userAccount.email) { if (!checkEmailIsUnique(email) || !checkAspEmailIsUnique(email)) { return(new GETResponseMessage(ResponseTypes.InvalidInputs, "Email address must be unique. ")); } } if (username != userAccount.username) { if (!checkUsernameIsUnique(username) || !checkAspUsernameIsUnique(username)) { return(new GETResponseMessage(ResponseTypes.InvalidInputs, "Username must be unique. ")); } } // Ensure that user is updating the access level correctly. // (A user who is part of a dealership must have a dealership access level). bool accessLevelAllowed = false; if (usersTeam.teamType == UserAccountType.Dealership && (accessLevel == (int)UserAccessTypes.DealershipAdministrator || accessLevel == (int)UserAccessTypes.DealershipUser)) { accessLevelAllowed = true; } else if (usersTeam.teamType == UserAccountType.Customer && (accessLevel == (int)UserAccessTypes.CustomerAdministrator || accessLevel == (int)UserAccessTypes.CustomerUser)) { accessLevelAllowed = true; } else if (accessLevel == 0) // Level 0 means don't change the access level. { accessLevelAllowed = true; } if (!accessLevelAllowed) { return(new GETResponseMessage(ResponseTypes.InvalidInputs, "You are not allowed to give this user account this access level. ")); } userAccount.username = username; userAccount.userid = username; userAccount.email = email; aspUserAccount.UserName = username; aspUserAccount.Email = email; UserAccessMaps userMap; if (usersTeam.teamType == UserAccountType.Dealership) { userMap = context.UserAccessMaps.FirstOrDefault(m => m.user_auto == userId && m.DealershipId == usersTeam.teamId); } else { userMap = context.UserAccessMaps.FirstOrDefault(m => m.user_auto == userId && m.customer_auto == usersTeam.teamId); } if (userMap == null) { return(new GETResponseMessage(ResponseTypes.Failed, "Failed to update the users access level record. Couldn't find it in the database. ")); } // If access level passed in is 0, we wont change their access. if (accessLevel != 0) { // If the user is getting changed to a dealership user, and wasn't already // we need to remove their access to all customers if (accessLevel == (int)UserAccessTypes.DealershipUser && userMap.AccessLevelTypeId != (int)UserAccessTypes.DealershipUser) { var list = context.USER_CRSF_CUST_EQUIP.Where(u => u.user_auto == userId).ToList(); context.USER_CRSF_CUST_EQUIP.RemoveRange(list); var list2 = context.UserAccessMaps.Where(m => m.user_auto == userId && m.customer_auto != null).ToList(); context.UserAccessMaps.RemoveRange(list2); } else if (accessLevel == (int)UserAccessTypes.DealershipAdministrator && userMap.AccessLevelTypeId != (int)UserAccessTypes.DealershipAdministrator) { long[] customerIds = context.CUSTOMER.Where(c => c.DealershipId == usersTeam.teamId).Select(c => c.customer_auto).ToArray(); foreach (long customerId in customerIds) { USER_CRSF_CUST_EQUIP accessRecord = new USER_CRSF_CUST_EQUIP() { user_auto = userId, customer_auto = customerId, level_type = 1, modified_user = "******" }; context.USER_CRSF_CUST_EQUIP.Add(accessRecord); } } userMap.AccessLevelTypeId = accessLevel; } try { context.SaveChanges(); return(new GETResponseMessage(ResponseTypes.Success, "User account updated successfully. ")); } catch (Exception e) { return(new GETResponseMessage(ResponseTypes.Failed, "Failed to save. " + e.Message)); } } }
public static List <Core.Common.Models.Client> Clients(SharedContext sharedCtx) { return(new List <Core.Common.Models.Client> { new Core.Common.Models.Client { ClientId = "client", ClientName = "client", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "openid" }, new Scope { Name = "role" }, new Scope { Name = "profile" }, new Scope { Name = "scim" }, new Scope { Name = "address" } }, GrantTypes = new List <GrantType> { GrantType.refresh_token, GrantType.password }, ResponseTypes = new List <ResponseType> { ResponseType.code, ResponseType.token, ResponseType.id_token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "https://localhost:4200/callback" } }, new Core.Common.Models.Client { ClientId = "client_userinfo_sig_rs256", ClientName = "client_userinfo_sig_rs256", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "client_userinfo_sig_rs256" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "openid" }, new Scope { Name = "role" }, new Scope { Name = "profile" }, new Scope { Name = "scim" } }, GrantTypes = new List <GrantType> { GrantType.refresh_token, GrantType.password }, ResponseTypes = new List <ResponseType> { ResponseType.code, ResponseType.token, ResponseType.id_token }, IdTokenSignedResponseAlg = "RS256", UserInfoSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "https://localhost:4200/callback" } }, new Core.Common.Models.Client { ClientId = "client_userinfo_enc_rsa15", ClientName = "client_userinfo_enc_rsa15", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "client_userinfo_enc_rsa15" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "openid" }, new Scope { Name = "role" }, new Scope { Name = "profile" }, new Scope { Name = "scim" } }, GrantTypes = new List <GrantType> { GrantType.refresh_token, GrantType.password }, ResponseTypes = new List <ResponseType> { ResponseType.code, ResponseType.token, ResponseType.id_token }, IdTokenSignedResponseAlg = "RS256", UserInfoSignedResponseAlg = "RS256", UserInfoEncryptedResponseAlg = "RSA1_5", UserInfoEncryptedResponseEnc = "A128CBC-HS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "https://localhost:4200/callback" } }, new Core.Common.Models.Client { ClientId = "clientWithWrongResponseType", ClientName = "clientWithWrongResponseType", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "clientWithWrongResponseType" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "openid" }, new Scope { Name = "role" }, new Scope { Name = "profile" }, new Scope { Name = "scim" } }, GrantTypes = new List <GrantType> { GrantType.refresh_token, GrantType.client_credentials }, ResponseTypes = new List <ResponseType> { ResponseType.id_token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "https://localhost:4200/callback" } }, new Core.Common.Models.Client { ClientId = "clientCredentials", ClientName = "clientCredentials", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "clientCredentials" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "api1" } }, GrantTypes = new List <GrantType> { GrantType.refresh_token, GrantType.client_credentials }, ResponseTypes = new List <ResponseType> { ResponseType.token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "https://localhost:4200/callback" } }, new Core.Common.Models.Client { ClientId = "basic_client", ClientName = "basic_client", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "basic_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_basic, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "api1" } }, GrantTypes = new List <GrantType> { GrantType.client_credentials }, ResponseTypes = new List <ResponseType> { ResponseType.token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "https://localhost:4200/callback" } }, new Core.Common.Models.Client { ClientId = "post_client", ClientName = "post_client", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "post_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "api1" } }, GrantTypes = new List <GrantType> { GrantType.client_credentials }, ResponseTypes = new List <ResponseType> { ResponseType.token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "https://localhost:4200/callback" } }, new Core.Common.Models.Client { ClientId = "jwt_client", ClientName = "jwt_client", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "jwt_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_jwt, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "api1" } }, GrantTypes = new List <GrantType> { GrantType.client_credentials }, ResponseTypes = new List <ResponseType> { ResponseType.token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "https://localhost:4200/callback" }, JsonWebKeys = new List <JsonWebKey> { sharedCtx.ModelSignatureKey, sharedCtx.ModelEncryptionKey } }, new Core.Common.Models.Client { ClientId = "private_key_client", ClientName = "private_key_client", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "private_key_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.private_key_jwt, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "api1" } }, GrantTypes = new List <GrantType> { GrantType.client_credentials }, ResponseTypes = new List <ResponseType> { ResponseType.token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "https://localhost:4200/callback" }, JwksUri = "http://localhost:5000/jwks_client" }, new Core.Common.Models.Client { ClientId = "authcode_client", ClientName = "authcode_client", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "authcode_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "api1" }, new Scope { Name = "openid" } }, GrantTypes = new List <GrantType> { GrantType.authorization_code }, ResponseTypes = new List <ResponseType> { ResponseType.code, ResponseType.token, ResponseType.id_token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "http://localhost:5000/callback" } }, new Core.Common.Models.Client { ClientId = "incomplete_authcode_client", ClientName = "incomplete_authcode_client", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "incomplete_authcode_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "api1" }, new Scope { Name = "openid" } }, GrantTypes = new List <GrantType> { GrantType.authorization_code }, ResponseTypes = new List <ResponseType> { ResponseType.id_token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "http://localhost:5000/callback" } }, new Core.Common.Models.Client { ClientId = "implicit_client", ClientName = "implicit_client", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "implicit_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "api1" }, new Scope { Name = "openid" } }, GrantTypes = new List <GrantType> { GrantType.@implicit }, ResponseTypes = new List <ResponseType> { ResponseType.token, ResponseType.id_token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "http://localhost:5000/callback" } }, new Core.Common.Models.Client { ClientId = "pkce_client", ClientName = "pkce_client", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "pkce_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "api1" }, new Scope { Name = "openid" } }, GrantTypes = new List <GrantType> { GrantType.authorization_code }, ResponseTypes = new List <ResponseType> { ResponseType.code, ResponseType.token, ResponseType.id_token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "http://localhost:5000/callback" }, RequirePkce = true }, new Core.Common.Models.Client { ClientId = "hybrid_client", ClientName = "hybrid_client", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "hybrid_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", AllowedScopes = new List <Scope> { new Scope { Name = "api1" }, new Scope { Name = "openid" } }, GrantTypes = new List <GrantType> { GrantType.authorization_code, GrantType.@implicit }, ResponseTypes = new List <ResponseType> { ResponseType.code, ResponseType.token, ResponseType.id_token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = new List <string> { "http://localhost:5000/callback" }, }, // Certificate test client. new Core.Common.Models.Client { ClientId = "certificate_client", ClientName = "Certificate test client", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.X509Thumbprint, Value = "E831DB1512E5AE431B6CDC6355CDA4CBBDB9CAAC" }, new ClientSecret { Type = ClientSecretTypes.X509Name, Value = "CN=localhost" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.tls_client_auth, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", AllowedScopes = new List <Scope> { new Scope { Name = "openid" } }, GrantTypes = new List <GrantType> { GrantType.password }, ResponseTypes = new List <ResponseType> { ResponseType.token, ResponseType.id_token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.native }, // Client credentials + stateless access token. new Core.Common.Models.Client { ClientId = "stateless_client", ClientName = "Stateless client", Secrets = new List <ClientSecret> { new ClientSecret { Type = ClientSecretTypes.SharedSecret, Value = "stateless_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", AllowedScopes = new List <Scope> { new Scope { Name = "openid" }, new Scope { Name = "register_client" }, new Scope { Name = "manage_profile" }, new Scope { Name = "manage_account_filtering" } }, GrantTypes = new List <GrantType> { GrantType.client_credentials }, ResponseTypes = new List <ResponseType> { ResponseType.token }, IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.native } }); }
public FindInspection(UndercarriageContext undercarriageContext, SharedContext sharedContext, long userId) { _context = undercarriageContext; _sharedContext = sharedContext; _user = _context.USER_TABLE.Find(userId); }
public BattleSystem(EntityFactory entityFactory, GameSettings gameSettings, MessageHub messageHub, SharedContext sharedContext) : base(Aspect.All()) { this.entityFactory = entityFactory; this.gameSettings = gameSettings; this.messageHub = messageHub; this.sharedContext = sharedContext; notificationHandlers = new Dictionary <Type, BoundMethod> { { typeof(ResetWorldMessage), new Action <ResetWorldMessage>(HandleResetWorld).Method.Bind() }, { typeof(PlayerJoinedMessage), new Action <PlayerJoinedMessage>(HandlePlayerJoined).Method.Bind() }, { typeof(PlayerLeftMessage), new Action <PlayerLeftMessage>(HandlePlayerLeft).Method.Bind() }, { typeof(RespawnPlayerMessage), new Action <RespawnPlayerMessage>(HandleRespawnPlayer).Method.Bind() }, { typeof(ReceivedInputMessage), new Action <ReceivedInputMessage>(HandleReceivedInputs).Method.Bind() } }; messageHub.SubscribeMany(HandleNewMessage, notificationHandlers); }
public WarmupState(SharedContext sharedContext, IReferenceRatingProviderFactory referenceRatingProviderFactory, ISettingsProvider settingsProvider) : base(sharedContext, referenceRatingProviderFactory, settingsProvider) { }
public EmployeeRepository(SharedContext context, UserService userService) : base(context, userService) { _db = context; }
public MyAccountPageSteps(IWebDriver driver, SharedContext sharedContext) { this.driver = driver; myAccountPage = new MyAccountPage(driver); this.sharedContext = sharedContext; }
public FakeUmaStartup(SharedContext context) { _context = context; }
public InputSystem(MouseListener mouseListener, KeyboardListener keyboardListener, IEnumerable <GamePadListener> gamePadListeners, IButtonMap buttonMap, SharedContext sharedContext, DebugLogger debugLogger, OrthographicCamera camera ) : base( Aspect.All(typeof(PlayerState), typeof(PlayerInput))) { this.buttonMap = buttonMap; this.sharedContext = sharedContext; this.debugLogger = debugLogger; this.camera = camera; mouseListener.MouseDown += OnMouseDown; mouseListener.MouseUp += OnMouseUp; keyboardListener.KeyPressed += OnKeyPressed; keyboardListener.KeyReleased += OnKeyReleased; foreach (var gamePadListener in gamePadListeners) { gamePadListener.ButtonDown += OnButtonDown; gamePadListener.ButtonUp += OnButtonUp; gamePadListener.TriggerMoved += OnTriggerMoved; } }
public Repo(SharedContext context, UserService userService) { _db = context; _userService = userService; DbSet = context.Set <TEntity>(); }
private static void InsertClients(SimpleIdentityServerContext context, SharedContext sharedCtx) { if (!context.Clients.Any()) { context.Clients.AddRange(new[] { new EF.Models.Client { ClientId = "client", ClientName = "client", ClientSecrets = new List <ClientSecret> { new ClientSecret { Id = Guid.NewGuid().ToString(), Type = SecretTypes.SharedSecret, Value = "client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", ClientScopes = new List <ClientScope> { new ClientScope { ScopeName = "openid" }, new ClientScope { ScopeName = "role" }, new ClientScope { ScopeName = "profile" }, new ClientScope { ScopeName = "scim" } }, GrantTypes = "4", ResponseTypes = "0,1,2", IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = "https://localhost:4200/callback" }, new EF.Models.Client { ClientId = "basic_client", ClientName = "basic_client", ClientSecrets = new List <ClientSecret> { new ClientSecret { Id = Guid.NewGuid().ToString(), Type = SecretTypes.SharedSecret, Value = "basic_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_basic, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", ClientScopes = new List <ClientScope> { new ClientScope { ScopeName = "api1" } }, GrantTypes = "3", ResponseTypes = "1", IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = "https://localhost:4200/callback" }, new EF.Models.Client { ClientId = "post_client", ClientName = "post_client", ClientSecrets = new List <ClientSecret> { new ClientSecret { Id = Guid.NewGuid().ToString(), Type = SecretTypes.SharedSecret, Value = "post_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", ClientScopes = new List <ClientScope> { new ClientScope { ScopeName = "api1" } }, GrantTypes = "3", ResponseTypes = "1", IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = "https://localhost:4200/callback" }, new EF.Models.Client { ClientId = "jwt_client", ClientName = "jwt_client", ClientSecrets = new List <ClientSecret> { new ClientSecret { Id = Guid.NewGuid().ToString(), Type = SecretTypes.SharedSecret, Value = "jwt_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_jwt, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", ClientScopes = new List <ClientScope> { new ClientScope { ScopeName = "api1" } }, GrantTypes = "3", ResponseTypes = "1", IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = "https://localhost:4200/callback", JsonWebKeys = new List <JsonWebKey> { sharedCtx.ModelSignatureKey, sharedCtx.ModelEncryptionKey } }, new EF.Models.Client { ClientId = "private_key_client", ClientName = "private_key_client", ClientSecrets = new List <ClientSecret> { new ClientSecret { Id = Guid.NewGuid().ToString(), Type = SecretTypes.SharedSecret, Value = "private_key_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.private_key_jwt, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", ClientScopes = new List <ClientScope> { new ClientScope { ScopeName = "api1" } }, GrantTypes = "3", ResponseTypes = "1", IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = "https://localhost:4200/callback", JwksUri = "http://localhost:5000/jwks_client" }, new EF.Models.Client { ClientId = "authcode_client", ClientName = "authcode_client", ClientSecrets = new List <ClientSecret> { new ClientSecret { Id = Guid.NewGuid().ToString(), Type = SecretTypes.SharedSecret, Value = "authcode_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", ClientScopes = new List <ClientScope> { new ClientScope { ScopeName = "api1" }, new ClientScope { ScopeName = "openid" } }, GrantTypes = "0", ResponseTypes = "0,1,2", IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = "http://localhost:5000/callback" }, new EF.Models.Client { ClientId = "implicit_client", ClientName = "implicit_client", ClientSecrets = new List <ClientSecret> { new ClientSecret { Id = Guid.NewGuid().ToString(), Type = SecretTypes.SharedSecret, Value = "implicit_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", ClientScopes = new List <ClientScope> { new ClientScope { ScopeName = "api1" }, new ClientScope { ScopeName = "openid" } }, GrantTypes = "1", ResponseTypes = "1,2", IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = "http://localhost:5000/callback" }, new EF.Models.Client { ClientId = "pkce_client", ClientName = "pkce_client", ClientSecrets = new List <ClientSecret> { new ClientSecret { Id = Guid.NewGuid().ToString(), Type = SecretTypes.SharedSecret, Value = "pkce_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", ClientScopes = new List <ClientScope> { new ClientScope { ScopeName = "api1" }, new ClientScope { ScopeName = "openid" } }, GrantTypes = "0", ResponseTypes = "0,1,2", IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = "http://localhost:5000/callback", RequirePkce = true }, new EF.Models.Client { ClientId = "hybrid_client", ClientName = "hybrid_client", ClientSecrets = new List <ClientSecret> { new ClientSecret { Id = Guid.NewGuid().ToString(), Type = SecretTypes.SharedSecret, Value = "hybrid_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", PolicyUri = "http://openid.net", TosUri = "http://openid.net", ClientScopes = new List <ClientScope> { new ClientScope { ScopeName = "api1" }, new ClientScope { ScopeName = "openid" } }, GrantTypes = "0,1", ResponseTypes = "0,1,2", IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.web, RedirectionUrls = "http://localhost:5000/callback" }, // Certificate test client. new EF.Models.Client { ClientId = "certificate_client", ClientName = "Certificate test client", ClientSecrets = new List <ClientSecret> { new ClientSecret { Id = Guid.NewGuid().ToString(), Type = SecretTypes.X509Thumbprint, Value = "E831DB1512E5AE431B6CDC6355CDA4CBBDB9CAAC" }, new ClientSecret { Id = Guid.NewGuid().ToString(), Type = SecretTypes.X509Name, Value = "CN=localhost" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.tls_client_auth, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", ClientScopes = new List <ClientScope> { new ClientScope { ScopeName = "openid" } }, GrantTypes = "4", ResponseTypes = "1,2", IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.native }, // Client credentials + stateless access token. new EF.Models.Client { ClientId = "stateless_client", ClientName = "Stateless client", ClientSecrets = new List <ClientSecret> { new ClientSecret { Id = Guid.NewGuid().ToString(), Type = SecretTypes.SharedSecret, Value = "stateless_client" } }, TokenEndPointAuthMethod = TokenEndPointAuthenticationMethods.client_secret_post, LogoUri = "http://img.over-blog-kiwi.com/1/47/73/14/20150513/ob_06dc4f_chiot-shiba-inu-a-vendre-prix-2015.jpg", ClientScopes = new List <ClientScope> { new ClientScope { ScopeName = "openid" } }, GrantTypes = "3", ResponseTypes = "1", IdTokenSignedResponseAlg = "RS256", ApplicationType = ApplicationTypes.native } }); } }
public void Configure(SharedContext context) { context.Database.EnsureCreated(); }
public GETResponseMessage createNewUserAccount(string username, string password, string email, int accessLevel, UserAccountType type, int teamId) { var newUser = new USER_TABLE(); if (type == UserAccountType.Dealership && (accessLevel != (int)UserAccessTypes.DealershipAdministrator && accessLevel != (int)UserAccessTypes.DealershipUser)) { return(new GETResponseMessage(ResponseTypes.InvalidInputs, "Failed. The access level you attempted to give is not valid for a dealership. ")); } else if (type == UserAccountType.Customer && (accessLevel != (int)UserAccessTypes.CustomerAdministrator && accessLevel != (int)UserAccessTypes.CustomerUser)) { return(new GETResponseMessage(ResponseTypes.InvalidInputs, "Failed. The access level you attempted to give is not valid for a customer. ")); } else if (!checkUsernameIsUnique(username)) { return(new GETResponseMessage(ResponseTypes.InvalidInputs, "Failed: Username already exists. ")); } else if (!checkEmailIsUnique(email)) { return(new GETResponseMessage(ResponseTypes.InvalidInputs, "Failed: Email already exists. ")); } else if (username.Length < 1 || password.Length < 1 || email.Length < 1) { return(new GETResponseMessage(ResponseTypes.InvalidInputs, "Failed: Invalid username, password, or email length. ")); } else { // Creating user account // GET related fields newUser.username = username; newUser.userid = username; newUser.passwd = password; newUser.email = email; newUser.language_auto = 1; // English newUser.currency_auto = 1; // AUD newUser.active = true; newUser.suspended = false; // Fields not related to GET, but that are currently required. newUser.internalemp = false; newUser.internalother = false; newUser.viewe = false; newUser.viewr = false; newUser.interpreter = false; newUser._protected = false; newUser.attach = false; newUser.print_copies = 0; newUser.sos = false; newUser.IsEquipmentEdit = false; if (type == UserAccountType.Customer) { newUser.customer_auto = teamId; } using (var context = new SharedContext()) { context.USER_TABLE.Add(newUser); try { context.SaveChanges(); } catch { return(new GETResponseMessage(ResponseTypes.Failed, "Failed: Unable to store user in database. ")); } // Creating user access mapping entry var newUserAccessMap = new UserAccessMaps(); newUserAccessMap.user_auto = newUser.user_auto; if (type == UserAccountType.Dealership) { newUserAccessMap.DealershipId = teamId; } else { newUserAccessMap.customer_auto = teamId; } newUserAccessMap.AccessLevelTypeId = accessLevel; context.UserAccessMaps.Add(newUserAccessMap); try { context.SaveChanges(); } catch { // IF this fails, user account is still created but with no access record. What should we do? // Need to ask Mason. return(new GETResponseMessage(ResponseTypes.Failed, "Failed: Unable to create access map record for the new user. ")); } } } // Insert module access records (required for old undercarriage application) var moduleAccess1 = new USER_MODULE_ACCESS() { moduleid = 0, user_auto = newUser.user_auto, }; var moduleAccess2 = new USER_MODULE_ACCESS() { moduleid = 1, user_auto = newUser.user_auto, }; var moduleAccess3 = new USER_MODULE_ACCESS() { moduleid = 3, user_auto = newUser.user_auto, }; using (var context = new SharedContext()) { context.USER_MODULE_ACCESS.Add(moduleAccess1); context.USER_MODULE_ACCESS.Add(moduleAccess2); context.USER_MODULE_ACCESS.Add(moduleAccess3); try { context.SaveChanges(); } catch { return(new GETResponseMessage(ResponseTypes.Failed, "Failed: User was created, but there was an error giving them module access. ")); } } return(new GETResponseMessage(ResponseTypes.Success, newUser.user_auto.ToString())); }
public PracticeState(SharedContext sharedContext, IReferenceRatingProviderFactory referenceRatingProviderFactory, ISettingsProvider settingsProvider) : base(sharedContext, referenceRatingProviderFactory, settingsProvider) { SharedContext.QualificationContext = null; SharedContext.RaceContext = null; }
public GETResponseMessage updateUserCustomerAccess(long userId, UserCustomerAccessDataSet[] customers) { using (var context = new SharedContext()) { var customersUserHasAccessTo = context.UserAccessMaps.Where(m => m.customer_auto != null && m.user_auto == userId).ToList(); foreach (UserCustomerAccessDataSet customer in customers) { if (customer.hasAccess) { if (!context.UserAccessMaps.Where(m => m.user_auto == userId && m.customer_auto == customer.customerId).Any()) { var customerAccessRecord = new UserAccessMaps() { AccessLevelTypeId = 3, customer_auto = customer.customerId, user_auto = userId }; context.UserAccessMaps.Add(customerAccessRecord); } if (!context.USER_CRSF_CUST_EQUIP.Where(m => m.user_auto == userId && m.customer_auto == customer.customerId && m.level_type == 1).Any()) { var customerAccessRecord = new USER_CRSF_CUST_EQUIP() { user_auto = userId, customer_auto = customer.customerId, level_type = 1, modified_user = "******" }; context.USER_CRSF_CUST_EQUIP.Add(customerAccessRecord); } } else { if (context.UserAccessMaps.Where(m => m.user_auto == userId && m.customer_auto == customer.customerId).Any()) { var record = context.UserAccessMaps.Where(m => m.user_auto == userId && m.customer_auto == customer.customerId).First(); context.UserAccessMaps.Remove(record); } if (context.USER_CRSF_CUST_EQUIP.Where(m => m.user_auto == userId && m.customer_auto == customer.customerId && m.level_type == 1).Any()) { var record = context.USER_CRSF_CUST_EQUIP.Where(m => m.user_auto == userId && m.customer_auto == customer.customerId && m.level_type == 1).First(); context.USER_CRSF_CUST_EQUIP.Remove(record); } } } try { context.SaveChanges(); } catch (Exception e) { return(new GETResponseMessage(ResponseTypes.Failed, "Failed to update users customer access. " + e.Message + e.InnerException)); } } return(new GETResponseMessage(ResponseTypes.Success, "Users customer access updated successfully. ")); }
public ExampleSteps(SharedContext sharedContext) { _sharedContext = sharedContext; }
public UserRequest(DbContext context, System.Security.Principal.IPrincipal LoggedInUser) { _context = (SharedContext)context; Initialized = Init(LoggedInUser); }
public JobsiteManager() { this._context = new SharedContext(); this._customerManager = new CustomerManager(); }
public CustomerAccess(SharedContext context) : base(context) { }
public WorkingCopyManager(FileSystem fileSystem, SharedContext sharedContext, RepositoryManager repositoryManager) { _fileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); _sharedContext = sharedContext ?? throw new ArgumentNullException(nameof(sharedContext)); _repositoryManager = repositoryManager ?? throw new ArgumentNullException(nameof(repositoryManager)); }
public BunnyWorld(SharedContext sharedContext, DebugLogger debugLogger) { this.sharedContext = sharedContext; this.debugLogger = debugLogger; }
public void SetContext() { _sharedContext = new SharedContext(); _objectContainer.RegisterInstanceAs(_sharedContext, dispose: true); }
public RaceState(IQualificationResultRatingProvider qualificationResultRatingProvider, IRatingUpdater ratingUpdater, ISessionFinishStateFactory finishStateFactory, SharedContext sharedContext, IReferenceRatingProviderFactory referenceRatingProviderFactory, ISettingsProvider settingsProvider) : base(sharedContext, referenceRatingProviderFactory, settingsProvider) { _qualificationResultRatingProvider = qualificationResultRatingProvider; _ratingUpdater = ratingUpdater; _finishStateFactory = finishStateFactory; _graceLaps = settingsProvider.DisplaySettingsViewModel.RatingSettingsViewModel.GraceLapsCount; _flashStopwatch = new Stopwatch(); _ratingComputed = false; _wasMoving = false; }
public EmitterSystem(Variables variables, EntityFactory entityFactory, SharedContext sharedContext) : base(Aspect.All(typeof(Emitter), typeof(Transform2))) { this.variables = variables; this.entityFactory = entityFactory; this.sharedContext = sharedContext; }
/// <summary> /// Initializes a new instance of the MessageInspector class with the specified context. /// </summary> /// <param name="context">Specify the context which will give information for MS-WOPI headers.</param> public MessageInspector(SharedContext context) { this.context = context; }
public FakeUmaStartup(SharedContext context) { _configuration = new UmaHostConfiguration(); _context = context; }