public ReadWriteACLFixture()
        {
            ACL = new ReadWriteAccessControlList();

            _resources  = GenerateRandomStringArray(1000);
            _principals = GenerateRandomStringArray(100);
            _operations = GenerateRandomStringArray(100);

            foreach (var resource in _resources)
            {
                foreach (var principal in _principals)
                {
                    foreach (var operation in _operations)
                    {
                        if (_random.Next(2) > 0)
                        {
                            ACL.Grant(principal, operation, resource);
                        }
                        else
                        {
                            ACL.Deny(principal, operation, resource);
                        }
                    }
                }
            }
        }
Пример #2
0
        public void Deny()
        {
            var acl = new ReadWriteAccessControlList();

            acl.Grant("principal1", "operation1", "resource1");
            acl.Deny("principal1", "operation1", "resource1");
            Assert.False(acl.IsGranted("principal1", "operation1", "resource1"));
        }
Пример #3
0
        public void IsHierarchyGranted2()
        {
            var acl = new ReadWriteAccessControlList();

            acl.Grant("principal1", "operation1", "r1");
            acl.Deny("principal1", "operation1", "r1.r2");
            Assert.False(acl.IsHierarchyGranted("principal1", "operation1", "r1.r2.r3"));
        }
Пример #4
0
        public void IsHierarchyGrantedEnum6()
        {
            var acl = new ReadWriteAccessControlList();

            acl.Grant("principal1", Operation.Write, "r1");
            acl.Deny("principal1", Operation.Read, "r1.r2.r3");
            Assert.False(acl.IsHierarchyGranted("principal1", Operation.Write, "r1.r2.r3.r4"));
        }