public void CanCreateNewGroup(GroupService<HierarchicalGroup> service, string tenant, string name)
            {
                var group = service.Create(tenant, name);

                group.ShouldNotBe(null);
                group.Tenant.ShouldBe(tenant);
                group.Name.ShouldBe(name);
            }
 public IdentityRepository()
 {
     var settings = SecuritySettings.FromConfiguration();
     settings.RequireAccountVerification = false;
     var config = new MembershipRebootConfiguration(settings);
     this.userSvc = new UserAccountService(config, new BrockAllen.MembershipReboot.Ef.DefaultUserAccountRepository());
     this.groupSvc = new GroupService(new BrockAllen.MembershipReboot.Ef.DefaultGroupRepository());
 }
 public GroupController(
     QueryableGroupRepository<NhGroup> groupRepository,
     GroupService<NhGroup> groupSvc,
     ISession session)
 {
     this.groupRepository = groupRepository;
     this.groupSvc = groupSvc;
     this.session = session;
 }
            public void CanDeleteGroup(GroupService<HierarchicalGroup> service, string tenant, string name)
            {
                var group = service.Create(tenant, name);

                service.Delete(group.ID);

                var fromDb = service.Get(group.ID);

                fromDb.ShouldBe(null);
            }
            public void CanRenameGroup(GroupService<HierarchicalGroup> service, string tenant, string name,
                string newName)
            {
                var group = service.Create(tenant, name);

                service.ChangeName(group.ID, newName);

                var fromDb = service.Get(group.ID);

                fromDb.ShouldNotBe(null);
                fromDb.Name.ShouldBe(newName);
            }
        public IIdentityManagerService Create()
        {
            var db = new DefaultMembershipRebootDatabase(this.connString);
            var userrepo = new DefaultUserAccountRepository(db);
            var usersvc = new UserAccountService<RelationalUserAccount>(config, userrepo);

            var grprepo = new DefaultGroupRepository(db);
            var grpsvc = new GroupService<RelationalGroup>(config.DefaultTenant, grprepo);

            var svc = new MembershipRebootIdentityManagerService<RelationalUserAccount, RelationalGroup>(usersvc, userrepo, grpsvc, grprepo);
            return new DisposableIdentityManagerService(svc, db);
        }
            public void CanAddChildToGroup(GroupService<HierarchicalGroup> service, string tenant, string name,
                string childName)
            {
                var group = service.Create(tenant, name);
                var child = service.Create(tenant, childName);

                service.AddChildGroup(group.ID, child.ID);

                var fromDb = service.Get(tenant, name);

                fromDb.ShouldNotBe(null);
                fromDb.Children.ShouldContain(x => x.ChildGroupID == child.ID);
            }
 public IIdentityManagerService Create()
 {
     var userrepo = new DefaultUserAccountRepository(this.connString);
     userrepo.QueryFilter = RelationalUserAccountQuery.Filter;
     userrepo.QuerySort = RelationalUserAccountQuery.Sort;
     var usersvc = new UserAccountService<RelationalUserAccount>(config, userrepo);
     
     var grprepo = new DefaultGroupRepository(this.connString);
     var grpsvc = new GroupService<RelationalGroup>(grprepo);
     
     var svc = new MembershipRebootIdentityManagerService<RelationalUserAccount, RelationalGroup>(usersvc, userrepo, grpsvc, grprepo);
     return new DisposableIdentityManagerService(svc, userrepo);
 }
        public IdentityRepository()
        {
            var settings = SecuritySettings.FromConfiguration();
            settings.RequireAccountVerification = false;
            settings.PasswordHashingIterationCount = 50000;
            var config = new MembershipRebootConfiguration(settings);
            var uarepo = new BrockAllen.MembershipReboot.Ef.DefaultUserAccountRepository();
            this.userSvc = new UserAccountService(config, uarepo);
            this.userQuery = uarepo;

            var grpRepo = new BrockAllen.MembershipReboot.Ef.DefaultGroupRepository();
            this.groupSvc = new GroupService(config.DefaultTenant, grpRepo);
            this.groupQuery = grpRepo;
        }
            public void CanDeleteGroupWithChildren(GroupService<HierarchicalGroup> service, string tenant, string name,
                string nparent1, string nparent2, string nchild)
            {
                var group = service.Create(tenant, name);
                var parent1 = service.Create(tenant, nparent1);
                var parent2 = service.Create(tenant, nparent2);
                var child = service.Create(tenant, nchild);

                service.AddChildGroup(parent1.ID, group.ID);
                service.AddChildGroup(parent2.ID, group.ID);
                service.AddChildGroup(parent2.ID, child.ID);

                service.Delete(group.ID);

                service.Get(group.ID).ShouldBe(null);
                service.Get(parent1.ID).Children.ShouldBeEmpty();
                parent2 = service.Get(parent2.ID);

                parent2.Children.ShouldNotBeEmpty();
                parent2.Children.Single().ChildGroupID.ShouldBe(child.ID);
            }
            public void CanRetrieveChildren(GroupService<HierarchicalGroup> service, string tenant, string name,
                string childName1, string childName2)
            {
                var group = service.Create(tenant, name);
                var child1 = service.Create(tenant, childName1);
                var child2 = service.Create(tenant, childName2);
                service.AddChildGroup(group.ID, child1.ID);
                service.AddChildGroup(group.ID, child2.ID);
                group = service.Get(group.ID);

                var children = service.GetChildren(group);

                children.ShouldNotBeEmpty();
                children.Count().ShouldBe(2);
            }
 public IdentityRepository(UserAccountService userSvc, GroupService groupSvc)
 {
     this.userSvc = userSvc;
     this.groupSvc = groupSvc;
 }
 public HomeController(GroupService groupSvc, IGroupQuery query)
 {
     this.groupSvc = groupSvc;
     this.query = query;
 }
 public HomeController(GroupService groupSvc)
 {
     this.groupSvc = groupSvc;
 }
 public RegisterFirstAdminUser()
 {
     var repo = new CustomUserRepository(new CustomDatabase("MembershipReboot"));
     this.userAccountService = new UserAccountService<CustomUser>(repo);
     this.groupSvc = new GroupService(new DefaultGroupRepository(new DefaultMembershipRebootDatabase("MembershipReboot")));
 }