public void DeleteSatisfactionConfig() { Home home; using (UserManager <Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { ctx.HomeSet.Add(home = new Home() { Title = "LaCorderieTest", EstablishmentType = EEstablishmentType.BB, Client = manager.FindByEmail("*****@*****.**"), }); } SatisfactionConfig toAdd; repo.Add(toAdd = new SatisfactionConfig() { Home = home, Title = "ttt" }); repo.Save(); repo.Delete(toAdd); repo.Save(); Assert.IsNull(ctx.SatisfactionConfigSet.FirstOrDefault(p => p.Home.Id == home.Id)); Assert.IsNull(ctx.SatisfactionConfigQuestionSet.Include("SatisfactionConfig").FirstOrDefault(p => p.SatisfactionConfig.Id == toAdd.Id)); Assert.IsNotNull(ctx.HomeSet.FirstOrDefault(p => p.Title == home.Title)); }
public void ForbiddenResource() { using (UserManager <Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetFieldGroupById(1, manager.FindByEmail("*****@*****.**").Id)); } }
public void GetRoomCategoryWithBadHomeId() { using (UserManager <Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetRoomCategoryById(1, manager.FindByEmail("*****@*****.**").Id)); } }
protected override bool IsAuthorized(HttpActionContext actionContext) { if (actionContext == null) { throw new ArgumentNullException("actionContext"); } IPrincipal user = actionContext.ControllerContext.RequestContext.Principal; if (user == null || user.Identity == null || !user.Identity.IsAuthenticated) { return(false); } if (Users.Length > 0 && !(Users.IndexOf(user.Identity.Name, StringComparison.OrdinalIgnoreCase) >= 0)) { return(false); } if (Roles.Length > 0) { IDependencyScope Scope = actionContext.Request.GetOwinContext().Get <IDependencyScope>(); ClientUserManager UserManager = Scope.GetService(typeof(ClientUserManager)) as ClientUserManager; var client = UserManager.FindByEmailAsync(user.Identity.Name).Result; var GroupList = UserManager.GetRolesAsync(client.Id).Result; var listRoles = Roles.Split(','); if (listRoles.Where(x => GroupList.Any(y => y.Equals(x))).Count() == 0) { return(false); } } return(true); }
public void UpdateUser() { var user = new UserInfo("Nickname", "Phonetic", "Username", 1, 2, true); var user2 = new UserInfo("Nickname2", "Phonetic2", "Username2", 2, 3, false); var manager = new ClientUserManager(); manager.Join(user); user = new UserInfo("NicknameU", "PhoneticU", "Username2", 1, 2, false); user2 = new UserInfo("Nickname2U", "Phonetic2U", "Username2", 2, 3, false); manager.Update(user); Assert.IsTrue(manager.GetIsJoined(user)); Assert.AreEqual(user, manager[user.UserId]); Assert.AreEqual(user.Nickname, manager[user.UserId].Nickname); Assert.AreEqual(user.Phonetic, manager[user.UserId].Phonetic); Assert.AreEqual(user.Username, manager[user.UserId].Username); Assert.AreEqual(user.UserId, manager[user.UserId].UserId); Assert.AreEqual(user.CurrentChannelId, manager[user.UserId].CurrentChannelId); Assert.AreEqual(user.IsMuted, manager[user.UserId].IsMuted); manager.Update(user2); Assert.IsTrue(manager.GetIsJoined(user2)); Assert.AreEqual(user2, manager[user2.UserId]); Assert.AreEqual(user2.Nickname, manager[user2.UserId].Nickname); Assert.AreEqual(user2.Phonetic, manager[user2.UserId].Phonetic); Assert.AreEqual(user2.Username, manager[user2.UserId].Username); Assert.AreEqual(user2.UserId, manager[user2.UserId].UserId); Assert.AreEqual(user2.CurrentChannelId, manager[user2.UserId].CurrentChannelId); Assert.AreEqual(user2.IsMuted, manager[user2.UserId].IsMuted); }
public void GetPeopleWithBadHomeId() { using (UserManager<Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetPeopleById(1, manager.FindByEmail("*****@*****.**").Id)); } }
public static async Task <string[]> MainAsync() { RestClient.SetDomain("https://*****:*****@gmail.com", FName = $"Name{random}", LName = $"LName{random}", Password = $"Password{random}", ConfirmPassword = $"Password{random}" }); ThingDto dto = things.Get(1); dto.Household = households.Get(dto.HouseholdId); Console.WriteLine(JsonConvert.SerializeObject(dto)); // dto = complete thing, ready for use return("Oi"); }
public void DeleteSatisfactionConfig() { Home home; using (UserManager<Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { ctx.HomeSet.Add(home = new Home() { Title = "LaCorderieTest", EstablishmentType = EEstablishmentType.BB, Client = manager.FindByEmail("*****@*****.**"), }); } SatisfactionConfig toAdd; repo.Add(toAdd = new SatisfactionConfig() { Home = home, Title = "ttt" }); repo.Save(); repo.Delete(toAdd); repo.Save(); Assert.IsNull(ctx.SatisfactionConfigSet.FirstOrDefault(p => p.Home.Id == home.Id)); Assert.IsNull(ctx.SatisfactionConfigQuestionSet.Include("SatisfactionConfig").FirstOrDefault(p => p.SatisfactionConfig.Id == toAdd.Id)); Assert.IsNotNull(ctx.HomeSet.FirstOrDefault(p => p.Title == home.Title)); }
public void Init() { ctx = EFContext.CreateContext(); repo = new HomeConfigRepository(ctx); using (UserManager <Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { entity = new HomeConfig() { Home = new Home() { Title = "LaCorderieTest", EstablishmentType = EEstablishmentType.BB, Client = manager.FindByEmail("*****@*****.**"), }, AutoSendSatisfactionEmail = false, DepositNotifEnabled = false, Devise = "$", EnableDinner = false, EnableDisplayActivities = false, EnableDisplayMeals = false, EnableDisplayProducts = false, EnableDisplayRooms = false, EnableReferencing = false, FollowStockEnable = false, HourFormat24 = true }; } repo.Add(entity); repo.Save(); }
public void Init() { ctx = EFContext.CreateContext(); repo = new HomeConfigRepository(ctx); using (UserManager<Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { entity = new HomeConfig() { Home = new Home() { Title = "LaCorderieTest", EstablishmentType = EEstablishmentType.BB, Client = manager.FindByEmail("*****@*****.**"), }, AutoSendSatisfactionEmail = false, DepositNotifEnabled = false, Devise = "$", EnableDinner = false, EnableDisplayActivities = false, EnableDisplayMeals = false, EnableDisplayProducts = false, EnableDisplayRooms = false, EnableReferencing = false, FollowStockEnable = false, HourFormat24 = true }; } repo.Add(entity); repo.Save(); }
public void ForbiddenResource() { using (UserManager <Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetRoomById(ctx.RoomSet.FirstOrDefault(x => x.Title == "Melanie").Id, (int)manager.FindByEmail("*****@*****.**").DefaultHomeId)); } }
public void ForbiddenResource() { using (UserManager<Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetRoomSupplementById(1, manager.FindByEmail("*****@*****.**").Id)); } }
public void ForbiddenResource() { using (UserManager<Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetRoomById(ctx.RoomSet.FirstOrDefault(x => x.Title == "Melanie").Id, (int)manager.FindByEmail("*****@*****.**").DefaultHomeId)); } }
public void GetForbiddenResource() { using (UserManager<Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Tax get = repo.GetTaxById(1, manager.FindByEmail("*****@*****.**").Id); Assert.IsNull(get); } }
public void GetForbiddenResource() { using (UserManager <Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Tax get = repo.GetTaxById(1, manager.FindByEmail("*****@*****.**").Id); Assert.IsNull(get); } }
public void DepartNonJoined() { var user = new UserInfo("Nickname", "Phonetic", "Username", 1, 2, true); var manager = new ClientUserManager(); Assert.IsFalse(manager.GetIsJoined(user)); Assert.IsFalse(manager.Depart(user)); }
public void ShouldFailBecauseOfNotPermitted() { using (UserManager<Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { RoomCategory get = repo.GetRoomCategoryById(ctx.RoomCategorySet.FirstOrDefault(p => p.Title == "Cat1").Id, (int)manager.FindByEmail("*****@*****.**").DefaultHomeId); Assert.IsNull(get); } }
public void ForbiddenResource() { using (UserManager <Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetDepositById(1, manager.FindByEmail("*****@*****.**").Id)); Assert.IsNull(repo.GetDepositByBookingId(1, 8590, (int)ctx.HomeSet.FirstOrDefault(x => x.Title == "LaCorderie").ClientId)); Assert.IsNull(repo.GetDepositByBookingId(1, 1, manager.FindByEmail("*****@*****.**").Id)); } }
public void ShouldNotGetBecauseOfNotPermitted() { //Bed get = repo.GetBedById(ctx.BedSet.FirstOrDefault(p => p.NumberPeople == 2).Id, (int)ctx.ClientSet.FirstOrDefault(p => p.Email == "*****@*****.**").DefaultHomeId); using (ClientUserManager manager = new ClientUserManager(new CustomUserStore(ctx))) { Bed get = repo.GetBedById(ctx.BedSet.FirstOrDefault(p => p.NumberPeople == 2).Id, (int)manager.FindByEmail("*****@*****.**").DefaultHomeId); Assert.IsNull(get); } }
public void ForbiddenResource() { using (UserManager<Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetDepositById(1, manager.FindByEmail("*****@*****.**").Id)); Assert.IsNull(repo.GetDepositByBookingId(1, 8590, (int)ctx.HomeSet.FirstOrDefault(x => x.Title == "LaCorderie").ClientId)); Assert.IsNull(repo.GetDepositByBookingId(1, 1, manager.FindByEmail("*****@*****.**").Id)); } }
public void ShouldFailBecauseOfNotPermitted() { using (UserManager <Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { RoomCategory get = repo.GetRoomCategoryById(ctx.RoomCategorySet.FirstOrDefault(p => p.Title == "Cat1").Id, (int)manager.FindByEmail("*****@*****.**").DefaultHomeId); Assert.IsNull(get); } }
public MainWindow() { RestClient.SetDomain("https://localhost:44371"); manager = new ClientUserManager(); InitializeComponent(); GoToLoginPage(); }
public void IndexerPresent() { var user = new UserInfo("Nickname", "Phonetic", "Username", 1, 2, true); var manager = new ClientUserManager(); manager.Join(user); Assert.AreEqual(user, manager[user.UserId]); }
public void ForbiddenResource() { repo.Add(b); repo.Save(); using (UserManager<Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetBookingById(b.Id, manager.FindByEmail("*****@*****.**").Id)); } }
public void ForbiddenResource() { repo.Add(b); repo.Save(); using (UserManager <Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetBookingById(b.Id, manager.FindByEmail("*****@*****.**").Id)); } }
public LoginPage(MainWindow loginWindow) { if (userManager == null) { userManager = new ClientUserManager(); } InitializeComponent(); this.mainWindow = loginWindow; }
public void GetBedWithBadHomeId() { repo.Add(entity); repo.Save(); using (UserManager<Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetBedById(entity.Id, manager.FindByEmail("*****@*****.**").Id)); } }
public void ForbiddenResource() { repo.Add(entity); repo.Save(); using (ClientUserManager manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetAdditionalBookingById(entity.Id, manager.FindByEmail("*****@*****.**").Id)); } }
public void GetBedWithBadHomeId() { repo.Add(entity); repo.Save(); using (UserManager <Client, int> manager = new ClientUserManager(new CustomUserStore(ctx))) { Assert.IsNull(repo.GetBedById(entity.Id, manager.FindByEmail("*****@*****.**").Id)); } }
public RegisterViewModel(IFrameNavigationService navigationService) { _navigationService = navigationService; User = new User(); _userManager = new ClientUserManager(); RegisterCommand = new RelayCommand(Register); LoginCommand = new RelayCommand(Login); }
public ClientTrading(NetClient netClient, ClientAuthenticator authenticator, ClientUserManager userManager) { this.netClient = netClient; this.authenticator = authenticator; this.userManager = userManager; this.activeTrades = new Dictionary <string, Trade>(); netClient.RegisterPacketHandler(MODULE_NAME, packetHandler); netClient.OnDisconnect += disconnectHandler; }
public void IndexerNotPresent() { var user = new UserInfo("Nickname", "Phonetic", "Username", 1, 2, true); var user2 = new UserInfo("Nickname2", "Phonetic2", "Username2", 2, 3, false); var manager = new ClientUserManager(); manager.Join(user); Assert.AreEqual(null, manager[user2.UserId]); }
//ctor public ChatViewModel(IFrameNavigationService navigationService) { _navigationService = navigationService; _userManager = new ClientUserManager(); _chatManager = new ClientChatManager(); UserToChatWith = $"You are talking with: { ClientUserManager.UserToChatWith}"; UserTitle = $"Welcome {ClientUserManager.CurrentUser}"; SendMessageCommand = new RelayCommand(SandMessage); BackCommand = new RelayCommand(Back); _chatManager.RegisterSendMessageEvent(ReciveMessage); _chatManager.RegisterUserDisconnectedEvent(ReturnToContactPage); }
public ClientChat(NetClient netClient, ClientAuthenticator authenticator, ClientUserManager userManager) { this.netClient = netClient; this.authenticator = authenticator; this.userManager = userManager; this.messageHistory = new List <ClientChatMessage>(); this.messageCountAtLastCheck = 0; netClient.RegisterPacketHandler(MODULE_NAME, packetHandler); netClient.OnDisconnect += disconnectHandler; }
public void Join() { var user = new UserInfo("Nickname", "Phonetic", "Username", 1, 2, true); var manager = new ClientUserManager(); manager.Join(user); Assert.IsTrue(manager.GetIsJoined(user)); Assert.IsTrue(((IEnumerable <IUserInfo>)manager).Contains(user)); Assert.AreEqual(user, manager[user.UserId]); }
public void UpdateEmpty() { var user = new UserInfo("Nickname", "Phonetic", "Username", 1, 2, true); var user2 = new UserInfo("Nickname2", "Phonetic2", "Username2", 2, 3, false); var manager = new ClientUserManager(); manager.Update(new [] { user, user2 }); Assert.IsTrue(manager.GetIsJoined(user)); Assert.IsTrue(manager.GetIsJoined(user2)); }
public async override Task Invoke(IOwinContext context) { if (context.Authentication.User != null && !String.IsNullOrWhiteSpace(context.Authentication.User.Identity.Name) && context.Authentication.User.Identity.IsAuthenticated) { IDependencyScope Scope = context.Get <IDependencyScope>(); ClientUserManager UserManager = Scope.GetService(typeof(ClientUserManager)) as ClientUserManager; var userClient = await UserManager.FindByEmailAsync(context.Authentication.User.Identity.Name); if (userClient.Locale != null && !string.IsNullOrEmpty(userClient.Locale)) { Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(userClient.Locale); } } await Next.Invoke(context); }
public UserCreatePage(MainWindow mainWindow) { if (userRest == null) { userRest = new UserRest(); } if (userManager == null) { userManager = new ClientUserManager(); } InitializeComponent(); this.mainWindow = mainWindow; }
//ctor public ContactsViewModel(IFrameNavigationService navigationService) { _navigationService = navigationService; _userManager = new ClientUserManager(); _interactionManager = new ClientInteractionManager(); ContactList = ConvertUserForUserView.ConvertUser(_userManager.GetContactList()); _userManager.RegisterNotifyEvent(ContactUptaded); _interactionManager.RegisterInvitationResponseEvent(HandleUserResponse); _interactionManager.RegisterChatRequestEvent(AgreeChatRequest); LogoutCommand = new RelayCommand(Logout); OpenChatCommand = new RelayCommand(OpenChat); OpenGameCommand = new RelayCommand(OpenGame); UserTitle = $"Welcome {ClientUserManager.CurrentUser}"; }
public void ExtensionGetIsJoinedUsername() { var user = new UserInfo("Nickname", "Phonetic", "Username", 1, 2, true); var user2 = new UserInfo("Nickname2", "Phonetic", "Username2", 2, 3, false); var manager = new ClientUserManager(); manager.Join(user); Assert.IsTrue(manager.GetIsJoined(user)); Assert.IsFalse(manager.GetIsJoined(user2)); manager.Join(user2); Assert.IsTrue(manager.GetIsJoined(user2)); manager.Depart(user); Assert.IsFalse(manager.GetIsJoined(user)); }
public ClientRepository(ManahostManagerDAL ctx) { _ctx = ctx; _userManager = new ClientUserManager(new CustomUserStore(_ctx)); }