in AdlsDotNetSDKUnitTest/SdkUnitTest.cs [2365:2415]
public void TestAclExtended()
{
string path = $"{UnitTestDir}/TestAclExtended";
_adlsClient.CreateDirectory(path, "750");
List<AclEntry> aclList = new List<AclEntry>()
{
new AclEntry(AclType.user, NonOwner2ObjectId, AclScope.Access,
AclAction.All), //Non owner client 2
};
_adlsClient.ModifyAclEntries(path, aclList);
AdlsClient nonOwner2 = SetupNonOwnerClient2();
string subFile1 = path + "/subFile1.txt";
try
{
using (nonOwner2.CreateFile(subFile1, IfExists.Overwrite, ""))
{
}
}
catch (IOException)
{
Assert.Fail("This should pass because mask is rwx so it still shouldnt have effective write");
}
_adlsClient.SetPermission(path, "750");
//When Acl is set and you change the group the mask is changed
string subFile2 = path + "/subFile2.txt";
try
{
using (nonOwner2.CreateFile(subFile2, IfExists.Overwrite, ""))
{
}
Assert.Fail("This shouldnt pass because mask is r-x so it still shouldnt have effective write");
}
catch (IOException)
{ }
List<AclEntry> aclList1 = new List<AclEntry>()
{
new AclEntry(AclType.user, NonOwner1ObjectId, AclScope.Access,
AclAction.WriteExecute), //Non owner client 2
};
_adlsClient.ModifyAclEntries(path, aclList1);//Mask is recalculated
try
{
using (nonOwner2.CreateFile(subFile2, IfExists.Overwrite, ""))
{
}
}
catch (IOException)
{
Assert.Fail("Create file should not raise an exception because recalculated mask is rwx and nonowner2 still shouldnt have effective write");
}
}