Exemplo n.º 1
0
        public virtual void TestWildCardAccessControlList()
        {
            AccessControlList acl;

            acl = new AccessControlList("*");
            Assert.True(acl.IsAllAllowed());
            acl = new AccessControlList("  * ");
            Assert.True(acl.IsAllAllowed());
            acl = new AccessControlList(" *");
            Assert.True(acl.IsAllAllowed());
            acl = new AccessControlList("*  ");
            Assert.True(acl.IsAllAllowed());
        }
Exemplo n.º 2
0
        public virtual void TestAddRemoveToWildCardACL()
        {
            AccessControlList acl = new AccessControlList(" * ");

            Assert.True(acl.IsAllAllowed());
            UserGroupInformation drwho = UserGroupInformation.CreateUserForTesting("*****@*****.**"
                                                                                   , new string[] { "aliens" });
            UserGroupInformation drwho2 = UserGroupInformation.CreateUserForTesting("*****@*****.**"
                                                                                    , new string[] { "tardis" });

            acl.AddUser("drwho");
            Assert.True(acl.IsAllAllowed());
            NUnit.Framework.Assert.IsFalse(acl.GetAclString().Contains("drwho"));
            acl.AddGroup("tardis");
            Assert.True(acl.IsAllAllowed());
            NUnit.Framework.Assert.IsFalse(acl.GetAclString().Contains("tardis"));
            acl.RemoveUser("drwho");
            Assert.True(acl.IsAllAllowed());
            AssertUserAllowed(drwho, acl);
            acl.RemoveGroup("tardis");
            Assert.True(acl.IsAllAllowed());
            AssertUserAllowed(drwho2, acl);
        }