Skip to content

Commit 60753e7

Browse files
authored
Feature/storage/data lake set permission bug (Azure#17591)
1 parent 98a57ae commit 60753e7

File tree

7 files changed

+504
-5
lines changed

7 files changed

+504
-5
lines changed

sdk/storage/Azure.Storage.Files.DataLake/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 12.6.0-beta.2 (Unreleased)
44
- Fixed bug where the Stream returned by DataLakeFileClient.OpenRead() would return a different Length after calls to Seek().
55
- Added constructors taking connection string to DataLakeServiceClient, DataLakeFileSystemClient, DataLakeDirectoryClient, and DataLakeFileClient.
6+
- Fixed bug where DataLakePathClient.SetPermissions(), DataLakeFileClient.SetPermissions(), and DataLakeDirectoryClient.SetPermissions() could not just set Owner or Group.
67

78
## 12.6.0-beta.1 (2020-12-07)
89
- Added support for service version 2020-04-08.

sdk/storage/Azure.Storage.Files.DataLake/api/Azure.Storage.Files.DataLake.netstandard2.0.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public DataLakeDirectoryClient(System.Uri directoryUri, Azure.Storage.StorageSha
5959
public override System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Files.DataLake.Models.PathInfo>> SetHttpHeadersAsync(Azure.Storage.Files.DataLake.Models.PathHttpHeaders httpHeaders = null, Azure.Storage.Files.DataLake.Models.DataLakeRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
6060
public override Azure.Response<Azure.Storage.Files.DataLake.Models.PathInfo> SetMetadata(System.Collections.Generic.IDictionary<string, string> metadata, Azure.Storage.Files.DataLake.Models.DataLakeRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
6161
public override System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Files.DataLake.Models.PathInfo>> SetMetadataAsync(System.Collections.Generic.IDictionary<string, string> metadata, Azure.Storage.Files.DataLake.Models.DataLakeRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
62-
public override Azure.Response<Azure.Storage.Files.DataLake.Models.PathInfo> SetPermissions(Azure.Storage.Files.DataLake.Models.PathPermissions permissions, string owner = null, string group = null, Azure.Storage.Files.DataLake.Models.DataLakeRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
63-
public override System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Files.DataLake.Models.PathInfo>> SetPermissionsAsync(Azure.Storage.Files.DataLake.Models.PathPermissions permissions, string owner = null, string group = null, Azure.Storage.Files.DataLake.Models.DataLakeRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
62+
public override Azure.Response<Azure.Storage.Files.DataLake.Models.PathInfo> SetPermissions(Azure.Storage.Files.DataLake.Models.PathPermissions permissions = null, string owner = null, string group = null, Azure.Storage.Files.DataLake.Models.DataLakeRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
63+
public override System.Threading.Tasks.Task<Azure.Response<Azure.Storage.Files.DataLake.Models.PathInfo>> SetPermissionsAsync(Azure.Storage.Files.DataLake.Models.PathPermissions permissions = null, string owner = null, string group = null, Azure.Storage.Files.DataLake.Models.DataLakeRequestConditions conditions = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
6464
}
6565
public partial class DataLakeFileClient : Azure.Storage.Files.DataLake.DataLakePathClient
6666
{

sdk/storage/Azure.Storage.Files.DataLake/src/DataLakeDirectoryClient.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ public override async Task<Response<PathInfo>> SetAccessControlListAsync(
12461246
/// a failure occurs.
12471247
/// </remarks>
12481248
public override Response<PathInfo> SetPermissions(
1249-
PathPermissions permissions,
1249+
PathPermissions permissions = default,
12501250
string owner = default,
12511251
string group = default,
12521252
DataLakeRequestConditions conditions = default,
@@ -1310,7 +1310,7 @@ public override Response<PathInfo> SetPermissions(
13101310
/// a failure occurs.
13111311
/// </remarks>
13121312
public override async Task<Response<PathInfo>> SetPermissionsAsync(
1313-
PathPermissions permissions,
1313+
PathPermissions permissions = default,
13141314
string owner = default,
13151315
string group = default,
13161316
DataLakeRequestConditions conditions = default,

sdk/storage/Azure.Storage.Files.DataLake/src/DataLakePathClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2932,7 +2932,7 @@ await DataLakeRestClient.Path.SetAccessControlAsync(
29322932
leaseId: conditions?.LeaseId,
29332933
owner: owner,
29342934
group: group,
2935-
permissions: permissions.ToSymbolicPermissions(),
2935+
permissions: permissions?.ToSymbolicPermissions(),
29362936
ifMatch: conditions?.IfMatch,
29372937
ifNoneMatch: conditions?.IfNoneMatch,
29382938
ifModifiedSince: conditions?.IfModifiedSince,

sdk/storage/Azure.Storage.Files.DataLake/tests/DirectoryClientTests.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,6 +3228,30 @@ public async Task SetPermissionsAsync()
32283228
AssertValidStoragePathInfo(response);
32293229
}
32303230

3231+
[Test]
3232+
public async Task SetPermissionsAsync_JustOwner_JustGroup()
3233+
{
3234+
await using DisposingFileSystem test = await GetNewFileSystem();
3235+
DataLakeDirectoryClient directory = await test.FileSystem.CreateDirectoryAsync(GetNewDirectoryName());
3236+
string owner = Recording.Random.NewGuid().ToString();
3237+
string group = Recording.Random.NewGuid().ToString();
3238+
3239+
Response<PathAccessControl> initalGetAccessControlResponse = await directory.GetAccessControlAsync();
3240+
3241+
// Act
3242+
Response<PathInfo> response = await directory.SetPermissionsAsync(owner: owner);
3243+
3244+
// Assert
3245+
AssertValidStoragePathInfo(response);
3246+
3247+
// Act
3248+
response = await directory.SetPermissionsAsync(group: group);
3249+
3250+
// Assert
3251+
await directory.GetAccessControlAsync();
3252+
AssertValidStoragePathInfo(response);
3253+
}
3254+
32313255
[Test]
32323256
public async Task SetPermissionsAsync_RootDirectory()
32333257
{

sdk/storage/Azure.Storage.Files.DataLake/tests/SessionRecords/DirectoryClientTests/SetPermissionsAsync_JustOwner_JustGroup.json

Lines changed: 237 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)