public virtual void TestInternalGetAclStatus() { UserGroupInformation currentUser = UserGroupInformation.GetCurrentUser(); AclStatus aclStatus = fcView.GetAclStatus(new Path("/internalDir")); Assert.Equal(aclStatus.GetOwner(), currentUser.GetUserName()); Assert.Equal(aclStatus.GetGroup(), currentUser.GetGroupNames() [0]); Assert.Equal(aclStatus.GetEntries(), AclUtil.GetMinimalAcl(Constants .Permission555)); NUnit.Framework.Assert.IsFalse(aclStatus.IsStickyBit()); }
/// <exception cref="System.IO.IOException"/> public override AclStatus GetAclStatus(Path path) { return(fc.GetAclStatus(path)); }
public virtual void TestAclOnMountEntry() { // Set ACLs on the first namespace and verify they are correct IList <AclEntry> aclSpec = Lists.NewArrayList(AclTestHelpers.AclEntry(AclEntryScope .Access, AclEntryType.User, FsAction.ReadWrite), AclTestHelpers.AclEntry(AclEntryScope .Access, AclEntryType.User, "foo", FsAction.Read), AclTestHelpers.AclEntry(AclEntryScope .Access, AclEntryType.Group, FsAction.Read), AclTestHelpers.AclEntry(AclEntryScope .Access, AclEntryType.Other, FsAction.None)); fcView.SetAcl(mountOnNn1, aclSpec); AclEntry[] expected = new AclEntry[] { AclTestHelpers.AclEntry(AclEntryScope.Access , AclEntryType.User, "foo", FsAction.Read), AclTestHelpers.AclEntry(AclEntryScope .Access, AclEntryType.Group, FsAction.Read) }; Assert.AssertArrayEquals(expected, AclEntryArray(fcView.GetAclStatus(mountOnNn1)) ); // Double-check by getting ACL status using FileSystem // instead of ViewFs Assert.AssertArrayEquals(expected, AclEntryArray(fc.GetAclStatus(targetTestRoot)) ); // Modify the ACL entries on the first namespace aclSpec = Lists.NewArrayList(AclTestHelpers.AclEntry(AclEntryScope.Default, AclEntryType .User, "foo", FsAction.Read)); fcView.ModifyAclEntries(mountOnNn1, aclSpec); expected = new AclEntry[] { AclTestHelpers.AclEntry(AclEntryScope.Access, AclEntryType .User, "foo", FsAction.Read), AclTestHelpers.AclEntry(AclEntryScope.Access, AclEntryType .Group, FsAction.Read), AclTestHelpers.AclEntry(AclEntryScope.Default, AclEntryType .User, FsAction.ReadWrite), AclTestHelpers.AclEntry(AclEntryScope.Default, AclEntryType .User, "foo", FsAction.Read), AclTestHelpers.AclEntry(AclEntryScope.Default, AclEntryType .Group, FsAction.Read), AclTestHelpers.AclEntry(AclEntryScope.Default, AclEntryType .Mask, FsAction.Read), AclTestHelpers.AclEntry(AclEntryScope.Default, AclEntryType .Other, FsAction.None) }; Assert.AssertArrayEquals(expected, AclEntryArray(fcView.GetAclStatus(mountOnNn1)) ); fcView.RemoveDefaultAcl(mountOnNn1); expected = new AclEntry[] { AclTestHelpers.AclEntry(AclEntryScope.Access, AclEntryType .User, "foo", FsAction.Read), AclTestHelpers.AclEntry(AclEntryScope.Access, AclEntryType .Group, FsAction.Read) }; Assert.AssertArrayEquals(expected, AclEntryArray(fcView.GetAclStatus(mountOnNn1)) ); Assert.AssertArrayEquals(expected, AclEntryArray(fc.GetAclStatus(targetTestRoot)) ); // Paranoid check: verify the other namespace does not // have ACLs set on the same path. NUnit.Framework.Assert.AreEqual(0, fcView.GetAclStatus(mountOnNn2).GetEntries().Count ); NUnit.Framework.Assert.AreEqual(0, fc2.GetAclStatus(targetTestRoot2).GetEntries() .Count); // Remove the ACL entries on the first namespace fcView.RemoveAcl(mountOnNn1); NUnit.Framework.Assert.AreEqual(0, fcView.GetAclStatus(mountOnNn1).GetEntries().Count ); NUnit.Framework.Assert.AreEqual(0, fc.GetAclStatus(targetTestRoot).GetEntries().Count ); // Now set ACLs on the second namespace aclSpec = Lists.NewArrayList(AclTestHelpers.AclEntry(AclEntryScope.Access, AclEntryType .User, "bar", FsAction.Read)); fcView.ModifyAclEntries(mountOnNn2, aclSpec); expected = new AclEntry[] { AclTestHelpers.AclEntry(AclEntryScope.Access, AclEntryType .User, "bar", FsAction.Read), AclTestHelpers.AclEntry(AclEntryScope.Access, AclEntryType .Group, FsAction.ReadExecute) }; Assert.AssertArrayEquals(expected, AclEntryArray(fcView.GetAclStatus(mountOnNn2)) ); Assert.AssertArrayEquals(expected, AclEntryArray(fc2.GetAclStatus(targetTestRoot2 ))); // Remove the ACL entries on the second namespace fcView.RemoveAclEntries(mountOnNn2, Lists.NewArrayList(AclTestHelpers.AclEntry(AclEntryScope .Access, AclEntryType.User, "bar", FsAction.Read))); expected = new AclEntry[] { AclTestHelpers.AclEntry(AclEntryScope.Access, AclEntryType .Group, FsAction.ReadExecute) }; Assert.AssertArrayEquals(expected, AclEntryArray(fc2.GetAclStatus(targetTestRoot2 ))); fcView.RemoveAcl(mountOnNn2); NUnit.Framework.Assert.AreEqual(0, fcView.GetAclStatus(mountOnNn2).GetEntries().Count ); NUnit.Framework.Assert.AreEqual(0, fc2.GetAclStatus(targetTestRoot2).GetEntries() .Count); }