Skip to content

Commit 612ac23

Browse files
committed
Added APIs to set and get access control properties for paths
1 parent c4b7b61 commit 612ac23

14 files changed

+2784
-926
lines changed

azure-storage-blob/ChangeLog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
## Version XX.XX.XX
66

7-
- Added support for directory operations: create, rename, and delete.
7+
- Added support for path operations(only available for accounts with ADLS Gen2 Inter-op enabled): create and delete directory, rename path, get and set path access control.
88

99
## Version 2.1.0:
1010

azure-storage-blob/azure/storage/blob/_deserialization.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@
3838
ResourceProperties,
3939
BlobPrefix,
4040
AccountInformation,
41-
UserDelegationKey, BatchSubResponse)
41+
BatchSubResponse,
42+
UserDelegationKey,
43+
PathProperties,
44+
)
4245
from ._encryption import _decrypt_blob
4346
from azure.storage.common.models import _list
4447
from azure.storage.common._error import (
@@ -653,3 +656,12 @@ def _parse_sub_response_to_http_response(sub_response):
653656
def _parse_continuation_token(response):
654657
marker = response.headers.get('x-ms-continuation')
655658
return marker if marker is not '' else None
659+
660+
661+
def _parse_path_permission_and_acl(response):
662+
props = PathProperties()
663+
props.owner = response.headers.get('x-ms-owner')
664+
props.group = response.headers.get('x-ms-group')
665+
props.permissions = response.headers.get('x-ms-permissions')
666+
props.acl = response.headers.get('x-ms-acl')
667+
return props

azure-storage-blob/azure/storage/blob/baseblobservice.py

Lines changed: 171 additions & 35 deletions
Large diffs are not rendered by default.

azure-storage-blob/azure/storage/blob/models.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,3 +975,24 @@ def __init__(self, key_value, key_hash):
975975
self.key_value = key_value
976976
self.key_hash = key_hash
977977
self.algorithm = 'AES256'
978+
979+
class PathProperties(object):
980+
"""
981+
Represent a path's properties(only permissions and acl at the moment).
982+
The path can be either a directory or a file.
983+
984+
:ivar string owner:
985+
Represents the owner of the path.
986+
:ivar string group:
987+
Represents the group of the path.
988+
:ivar string permissions:
989+
Represents the permissions of the path.
990+
:ivar string acl:
991+
Represents the acl of the path.
992+
"""
993+
994+
def __init__(self):
995+
self.owner = None
996+
self.group = None
997+
self.permissions = None
998+
self.acl = None

tests/blob/test_directory.py renamed to tests/blob/test_path.py

Lines changed: 160 additions & 52 deletions
Large diffs are not rendered by default.

tests/recordings/test_directory.test_create_delete_directory_with_hierarchical_namespace.yaml

Lines changed: 0 additions & 245 deletions
This file was deleted.

0 commit comments

Comments
 (0)