Exemplo n.º 1
0
 private void WriteTableBody(AclExpansionTree aclExpansionTree)
 {
     foreach (var userNode in aclExpansionTree.Tree)
     {
         WriteTableBody_ProcessUser(userNode);
     }
 }
Exemplo n.º 2
0
        public void WriteAclExpansion(List <AclExpansionEntry> aclExpansion)
        {
            ArgumentUtility.CheckNotNull("aclExpansion", aclExpansion);

            var aclExpansionTree = new AclExpansionTree(aclExpansion);

            Implementation.WritePageStart(AclToolsExpansion.PageTitleSingleFile); // re-motion ACL Expansion
            Implementation.WriteTableStart("remotion-ACL-expansion-table");
            WriteTableHeaders();
            WriteTableBody(aclExpansionTree);
            Implementation.WriteTableEnd();
            Implementation.WritePageEnd();
        }
Exemplo n.º 3
0
        public void SingleAclSingleUserExpansionTest()
        {
            using (new CultureScope("de-DE"))
            {
                var users = ListObjectMother.New(User);

                var acls = ListObjectMother.New <AccessControlList> (Acl);

                List <AclExpansionEntry> aclExpansion = GetAclExpansionEntryList(users, acls, false);

                //WriteAclExpansionAsHtmlToDisk(aclExpansion, "c:\\temp\\aaa.html");

                var aclExpansionTree = new AclExpansionTree(aclExpansion);

                //WriteAclExpansionTreeToConsole(aclExpansionTree);

                var userNodes = aclExpansionTree.Tree;
                Assert.That(userNodes.Count, Is.EqualTo(1)); // # users
                Assert.That(userNodes[0].Key, Is.EqualTo(User));

                var roleNodes = userNodes[0].Children;
                Assert.That(roleNodes.Count, Is.EqualTo(1)); // # roles
                Assert.That(roleNodes[0].Key, Is.EqualTo(User.Roles[0]));

                var classNodes = roleNodes[0].Children;
                Assert.That(classNodes.Count, Is.EqualTo(1)); // # classes
                Assert.That(classNodes[0].Key.StatefulAccessControlLists, Has.Member(Acl));

                var stateNodes = classNodes[0].Children;
                Assert.That(stateNodes.Count, Is.EqualTo(2));             // # states

                Assert.That(stateNodes[0].Children.Count, Is.EqualTo(2)); // # states in group with same AclExpansionEntry ignoring StateCombinations
                Assert.That(stateNodes[1].Children.Count, Is.EqualTo(1)); // # states in group with same AclExpansionEntry ignoring StateCombinations

                foreach (var aclExpansionEntryTreeNode in stateNodes)
                {
                    foreach (AclExpansionEntry aee in aclExpansionEntryTreeNode.Children)
                    {
                        Assert.That(aee.GetStateCombinations(), Is.SubsetOf(Acl.StateCombinations));
                    }
                }
            }
        }
Exemplo n.º 4
0
        public void StatelessAccessControlListSortOrderTest()
        {
            using (new CultureScope("de-DE"))
            {
                var users = ListObjectMother.New(User);

                var statelessAcl = CreateStatelessAcl(Ace);
                var acls         = ListObjectMother.New(Acl, statelessAcl);

                List <AclExpansionEntry> aclExpansionEntryList = GetAclExpansionEntryList(users, acls, false);

                var aclExpansionTreeInverseSorted = new AclExpansionTree(
                    aclExpansionEntryList,
                    (classEntry => (classEntry.AccessControlList is StatefulAccessControlList) ? "A" : "B")); // sort stateful before stateless
                Assert.That(aclExpansionTreeInverseSorted.Tree[0].Children[0].Children.Count, Is.EqualTo(2));
                Assert.That(aclExpansionTreeInverseSorted.Tree[0].Children[0].Children[0].Children[0].Children[0].AccessControlList, Is.EqualTo(Acl));

                var aclExpansionTreeDefaultSorted = new AclExpansionTree(aclExpansionEntryList);
                Assert.That(aclExpansionTreeDefaultSorted.Tree[0].Children[0].Children.Count, Is.EqualTo(2));
                Assert.That(aclExpansionTreeDefaultSorted.Tree[0].Children[0].Children[0].Children[0].Children[0].AccessControlList, Is.EqualTo(statelessAcl));
            }
        }