From b6c54dd212321c1a94380370a37f2d4b43477c61 Mon Sep 17 00:00:00 2001 From: microzchang Date: Thu, 18 Jul 2024 17:59:57 +0800 Subject: [PATCH 1/9] feature code --- sdk/storage/assets.json | 2 +- .../storage/files/shares/rest_client.hpp | 35 +++++ .../storage/files/shares/share_client.hpp | 17 +++ .../storage/files/shares/share_options.hpp | 35 ++++- .../storage/files/shares/share_responses.hpp | 17 +++ .../src/rest_client.cpp | 52 ++++++++ .../src/share_client.cpp | 21 +++ .../src/share_directory_client.cpp | 3 + .../src/share_file_client.cpp | 2 + .../test/ut/share_client_test.cpp | 43 ++++++ .../test/ut/share_directory_client_test.cpp | 123 ++++++++++++++++++ .../test/ut/share_file_client_test.cpp | 69 ++++++++++ 12 files changed, 416 insertions(+), 3 deletions(-) diff --git a/sdk/storage/assets.json b/sdk/storage/assets.json index da2ed90f7b..1b1d5b97fc 100644 --- a/sdk/storage/assets.json +++ b/sdk/storage/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "cpp", "TagPrefix": "cpp/storage", - "Tag": "cpp/storage_f113099cfb" + "Tag": "cpp/storage_a10995a69c" } diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp index af6aa6af18..d0ca4e7503 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp @@ -796,6 +796,33 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ DateTime LastModified; }; + /** + * @brief Optional. Available for version 2023-06-01 and later. Specifies the format in which + * the permission is returned. Acceptable values are SDDL or binary. If + * x-ms-file-permission-format is unspecified or explicitly set to SDDL, the permission is + * returned in SDDL format. If x-ms-file-permission-format is explicitly set to binary, the + * permission is returned as a base64 string representing the binary encoding of the permission. + */ + class FilePermissionFormat final { + public: + /** Constructs a new FilePermissionFormat instance */ + FilePermissionFormat() = default; + /** Constructs a new FilePermissionFormat from a string. */ + explicit FilePermissionFormat(std::string value) : m_value(std::move(value)) {} + /** Compares with another FilePermissionFormat. */ + bool operator==(const FilePermissionFormat& other) const { return m_value == other.m_value; } + /** Compares with another FilePermissionFormat. */ + bool operator!=(const FilePermissionFormat& other) const { return !(*this == other); } + /** Converts the value to a string. */ + const std::string& ToString() const { return m_value; } + /** Constant value of type FilePermissionFormat: Sddl */ + AZ_STORAGE_FILES_SHARES_DLLEXPORT const static FilePermissionFormat Sddl; + /** Constant value of type FilePermissionFormat: Binary */ + AZ_STORAGE_FILES_SHARES_DLLEXPORT const static FilePermissionFormat Binary; + + private: + std::string m_value; + }; /** * @brief Response type for #Azure::Storage::Files::Shares::ShareClient::CreatePermission. */ @@ -816,6 +843,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { * The permission in the Security Descriptor Definition Language (SDDL). */ std::string Permission; + Nullable Format; }; } // namespace _detail /** @@ -2243,6 +2271,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { struct GetSharePermissionOptions final { std::string FilePermissionKey; + Nullable FilePermissionFormat; Nullable FileRequestIntent; }; static Response GetPermission( @@ -2353,6 +2382,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { struct SetDirectoryPropertiesOptions final { Nullable FilePermission; + Nullable FilePermissionFormat; Nullable FilePermissionKey; std::string FileAttributes; Nullable FileCreationTime; @@ -2434,6 +2464,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Nullable FileLastWriteTime; Nullable FileChangeTime; Nullable FilePermission; + Nullable FilePermissionFormat; Nullable FilePermissionKey; std::map Metadata; Nullable AllowTrailingDot; @@ -2460,6 +2491,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Nullable FileContentDisposition; std::map Metadata; Nullable FilePermission; + Nullable FilePermissionFormat; Nullable FilePermissionKey; std::string FileAttributes; Nullable FileCreationTime; @@ -2519,6 +2551,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Nullable> FileContentMD5; Nullable FileContentDisposition; Nullable FilePermission; + Nullable FilePermissionFormat; Nullable FilePermissionKey; std::string FileAttributes; Nullable FileCreationTime; @@ -2647,6 +2680,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { std::map Metadata; std::string CopySource; Nullable FilePermission; + Nullable FilePermissionFormat; Nullable FilePermissionKey; Nullable FilePermissionCopyMode; Nullable IgnoreReadOnly; @@ -2715,6 +2749,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Nullable FileLastWriteTime; Nullable FileChangeTime; Nullable FilePermission; + Nullable FilePermissionFormat; Nullable FilePermissionKey; std::map Metadata; Nullable FileContentType; diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp index 2741369d21..70f8141a47 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp @@ -242,6 +242,23 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { const GetSharePermissionOptions& options = GetSharePermissionOptions(), const Azure::Core::Context& context = Azure::Core::Context()) const; + /** + * @brief Gets the permission of the share using the specific key. + * @param permissionKey The permission key of a permission. + * @param filePermissionFormat Optional. Available for version 2024-11-04 and later. Specifies + * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or + * explicityly set to , the permission will be + * returned in SSDL format. + * @param options Optional parameters to get share's permission. + * @param context Context for cancelling long running operations. + * @return Azure::Response containing the permission string with specified key. + */ + Azure::Response GetPermission( + const std::string& permissionKey, + const Nullable filePermissionFormat, + const GetSharePermissionOptions& options = GetSharePermissionOptions(), + const Azure::Core::Context& context = Azure::Core::Context()) const; + private: Azure::Core::Url m_shareUrl; std::shared_ptr m_pipeline; diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp index d02d1e2065..486f413143 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp @@ -311,6 +311,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ struct CreateSharePermissionOptions final { + /** + * Format of Permission. + */ + Nullable FilePermissionFormat; }; /** @@ -387,6 +391,11 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ Azure::Nullable FilePermission; + /** + * Format of Permission. + */ + Nullable FilePermissionFormat; + /** * A name-value pair to associate with a file storage object. */ @@ -443,6 +452,11 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ Azure::Nullable FilePermission; + /** + * Format of Permission. + */ + Nullable FilePermissionFormat; + /** * A name-value pair to associate with a file storage object. */ @@ -477,6 +491,11 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { * group and dacl. */ Azure::Nullable FilePermission; + + /** + * Format of Permission. + */ + Nullable FilePermissionFormat; }; /** @@ -590,10 +609,16 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { /** * This permission is the security descriptor for the file specified in the Security - * Descriptor Definition Language (SDDL). If not specified, 'inherit' is used. + * Descriptor Definition Language (SDDL) or base64 encoded + * binary format. If not specified, 'inherit' is used. */ Azure::Nullable Permission; + /** + * Format of Permission. + */ + Nullable FilePermissionFormat; + /** * SMB properties to set for the file. */ @@ -722,10 +747,16 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { /** * This permission is the security descriptor for the file specified in the Security - * Descriptor Definition Language (SDDL). If not specified, 'inherit' is used. + * Descriptor Definition Language (SDDL) or base64 encoded + * binary format. If not specified, 'inherit' is used. */ Azure::Nullable Permission; + /** + * Format of Permission. + */ + Nullable FilePermissionFormat; + /** * Specify this to resize a file to the specified value. */ diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp index ae875ca949..5a471a2450 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp @@ -317,6 +317,23 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ Azure::Nullable AccessRights; }; + + /** + * @brief A permission at the share level. + */ + struct ShareFilePermission final + { + /** + * The permission in the Security Descriptor Definition Language (SDDL) or base64 encoded + * binary format. + */ + std::string Permission; + + /** + * Format of Permission. + */ + Nullable PermissionFormat; + }; } // namespace Models /** diff --git a/sdk/storage/azure-storage-files-shares/src/rest_client.cpp b/sdk/storage/azure-storage-files-shares/src/rest_client.cpp index acc3e0a984..6b308a857a 100644 --- a/sdk/storage/azure-storage-files-shares/src/rest_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/rest_client.cpp @@ -106,6 +106,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { const ShareRootSquash ShareRootSquash::RootSquash("RootSquash"); const ShareRootSquash ShareRootSquash::AllSquash("AllSquash"); const DeleteSnapshotsOption DeleteSnapshotsOption::Include("include"); + const FilePermissionFormat FilePermissionFormat::Sddl("sddl"); + const FilePermissionFormat FilePermissionFormat::Binary("binary"); FileAttributes::FileAttributes(const std::string& value) { const std::string delimiter = " | "; @@ -1443,6 +1445,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { auto jsonRoot = Core::Json::_internal::json::object(); jsonRoot["permission"] = options.SharePermission.Permission; + if (options.SharePermission.Format.HasValue()) + { + jsonRoot["format"] = options.SharePermission.Format.Value().ToString(); + } jsonBody = jsonRoot.dump(); } Core::IO::MemoryBodyStream requestBody( @@ -1482,6 +1488,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey); } + if (options.FilePermissionFormat.HasValue() + && !options.FilePermissionFormat.Value().ToString().empty()) + { + request.SetHeader( + "x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString()); + } request.SetHeader("x-ms-version", "2024-11-04"); if (options.FileRequestIntent.HasValue() && !options.FileRequestIntent.Value().ToString().empty()) @@ -1500,6 +1512,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { auto jsonRoot = Core::Json::_internal::json::parse(responseBody.begin(), responseBody.end()); response.Permission = jsonRoot["permission"].get(); + if (jsonRoot.count("format") != 0) + { + response.Format = Models::FilePermissionFormat(jsonRoot["format"].get()); + } } return Response( std::move(response), std::move(pRawResponse)); @@ -2075,6 +2091,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { request.SetHeader("x-ms-file-permission", options.FilePermission.Value()); } + if (options.FilePermissionFormat.HasValue() + && !options.FilePermissionFormat.Value().ToString().empty()) + { + request.SetHeader( + "x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString()); + } if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty()) { request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value()); @@ -2902,6 +2924,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { request.SetHeader("x-ms-file-permission", options.FilePermission.Value()); } + if (options.FilePermissionFormat.HasValue() + && !options.FilePermissionFormat.Value().ToString().empty()) + { + request.SetHeader( + "x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString()); + } if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty()) { request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value()); @@ -3004,6 +3032,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { request.SetHeader("x-ms-file-permission", options.FilePermission.Value()); } + if (options.FilePermissionFormat.HasValue() + && !options.FilePermissionFormat.Value().ToString().empty()) + { + request.SetHeader( + "x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString()); + } if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty()) { request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value()); @@ -3472,6 +3506,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { request.SetHeader("x-ms-file-permission", options.FilePermission.Value()); } + if (options.FilePermissionFormat.HasValue() + && !options.FilePermissionFormat.Value().ToString().empty()) + { + request.SetHeader( + "x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString()); + } if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty()) { request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value()); @@ -4073,6 +4113,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { request.SetHeader("x-ms-file-permission", options.FilePermission.Value()); } + if (options.FilePermissionFormat.HasValue() + && !options.FilePermissionFormat.Value().ToString().empty()) + { + request.SetHeader( + "x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString()); + } if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty()) { request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value()); @@ -4495,6 +4541,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { request.SetHeader("x-ms-file-permission", options.FilePermission.Value()); } + if (options.FilePermissionFormat.HasValue() + && !options.FilePermissionFormat.Value().ToString().empty()) + { + request.SetHeader( + "x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString()); + } if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty()) { request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value()); diff --git a/sdk/storage/azure-storage-files-shares/src/share_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_client.cpp index cf91e30536..d65b66e51e 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_client.cpp @@ -321,6 +321,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { (void)options; auto protocolLayerOptions = _detail::ShareClient::CreateSharePermissionOptions(); protocolLayerOptions.SharePermission.Permission = permission; + protocolLayerOptions.SharePermission.Format = options.FilePermissionFormat; protocolLayerOptions.FileRequestIntent = m_shareTokenIntent; return _detail::ShareClient::CreatePermission( *m_pipeline, m_shareUrl, protocolLayerOptions, context); @@ -341,4 +342,24 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { return Azure::Response(result.Value.Permission, std::move(result.RawResponse)); } + Azure::Response ShareClient::GetPermission( + const std::string& permissionKey, + const Nullable filePermissionFormat, + const GetSharePermissionOptions& options, + const Azure::Core::Context& context) const + { + (void)options; + auto protocolLayerOptions = _detail::ShareClient::GetSharePermissionOptions(); + protocolLayerOptions.FilePermissionKey = permissionKey; + protocolLayerOptions.FileRequestIntent = m_shareTokenIntent; + protocolLayerOptions.FilePermissionFormat = filePermissionFormat; + auto result = _detail::ShareClient::GetPermission( + *m_pipeline, m_shareUrl, protocolLayerOptions, context); + Models::ShareFilePermission ret; + ret.Permission = std::move(result.Value.Permission); + ret.PermissionFormat = result.Value.Format; + return Azure::Response( + std::move(ret), std::move(result.RawResponse)); + } + }}}} // namespace Azure::Storage::Files::Shares diff --git a/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp index 64c86dac3c..434fe79c3b 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp @@ -294,6 +294,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { protocolLayerOptions.AllowSourceTrailingDot = m_allowSourceTrailingDot; protocolLayerOptions.FileRequestIntent = m_shareTokenIntent; protocolLayerOptions.FileContentType = options.ContentType; + protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat; auto response = _detail::FileClient::Rename( *m_pipeline, destinationFileUrl, protocolLayerOptions, context); @@ -356,6 +357,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot; protocolLayerOptions.AllowSourceTrailingDot = m_allowSourceTrailingDot; protocolLayerOptions.FileRequestIntent = m_shareTokenIntent; + protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat; auto response = _detail::DirectoryClient::Rename( *m_pipeline, destinationDirectoryUrl, protocolLayerOptions, context); @@ -466,6 +468,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { } protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot; protocolLayerOptions.FileRequestIntent = m_shareTokenIntent; + protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat; return _detail::DirectoryClient::SetProperties( *m_pipeline, m_shareDirectoryUrl, protocolLayerOptions, context); } diff --git a/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp index 2b60055378..433a87c95d 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp @@ -217,6 +217,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId; protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot; protocolLayerOptions.FileRequestIntent = m_shareTokenIntent; + protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat; auto result = _detail::FileClient::Create(*m_pipeline, m_shareFileUrl, protocolLayerOptions, context); Models::CreateFileResult ret; @@ -541,6 +542,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { } protocolLayerOptions.AllowTrailingDot = m_allowTrailingDot; protocolLayerOptions.FileRequestIntent = m_shareTokenIntent; + protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat; return _detail::FileClient::SetHttpHeaders( *m_pipeline, m_shareFileUrl, protocolLayerOptions, context); diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp index 5c0dc9d457..3330ed3a3b 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp @@ -780,4 +780,47 @@ namespace Azure { namespace Storage { namespace Test { properties.EnableSnapshotVirtualDirectoryAccess.HasValue() && !properties.EnableSnapshotVirtualDirectoryAccess.Value()); } + + TEST_F(FileShareClientTest, FilePermisionFormat) + { + // sddl format + { + auto sddlPermission + = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-" + "1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-" + "188441444-3053964)S:NO_ACCESS_CONTROL"; + Files::Shares::CreateSharePermissionOptions options; + options.FilePermissionFormat = Files::Shares::Models::FilePermissionFormat::Sddl; + auto permissionKey + = m_shareClient->CreatePermission(sddlPermission, options).Value.FilePermissionKey; + auto permission + = m_shareClient + ->GetPermission(permissionKey, Files::Shares::Models::FilePermissionFormat::Sddl) + .Value; + EXPECT_EQ(sddlPermission, permission.Permission); + EXPECT_TRUE(permission.PermissionFormat.HasValue()); + EXPECT_EQ( + Files::Shares::Models::FilePermissionFormat::Sddl, permission.PermissionFormat.Value()); + } + // binary format + { + auto binaryPermission + = "AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/" + "AR8AAQEAAAAAAAUSAAAAAAAYAP8BHwABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAA" + "AABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUAAAAAAAUVAAAAoGXPfnhLm1/nfIdwr/" + "1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA="; + Files::Shares::CreateSharePermissionOptions options; + options.FilePermissionFormat = Files::Shares::Models::FilePermissionFormat::Binary; + auto permissionKey + = m_shareClient->CreatePermission(binaryPermission, options).Value.FilePermissionKey; + auto permission + = m_shareClient + ->GetPermission(permissionKey, Files::Shares::Models::FilePermissionFormat::Binary) + .Value; + EXPECT_EQ(binaryPermission, permission.Permission); + EXPECT_TRUE(permission.PermissionFormat.HasValue()); + EXPECT_EQ( + Files::Shares::Models::FilePermissionFormat::Binary, permission.PermissionFormat.Value()); + } + } }}} // namespace Azure::Storage::Test diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp index 48a76a956b..e844b41fc7 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp @@ -1229,4 +1229,127 @@ namespace Azure { namespace Storage { namespace Test { m_fileShareDirectoryClient->GetUrl(), credential, clientOptions); EXPECT_THROW(directoryClient.GetProperties(), StorageException); } + + TEST_F(FileShareDirectoryClientTest, FilePermisionFormat) + { + // sddl format + { + auto sddlPermission + = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-" + "1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-" + "626881126-" + "188441444-3053964)S:NO_ACCESS_CONTROL"; + auto permiisionFormat = Files::Shares::Models::FilePermissionFormat::Sddl; + + // Set Properties + Files::Shares::SetDirectoryPropertiesOptions setOptions; + setOptions.FilePermissionFormat = permiisionFormat; + setOptions.FilePermission = sddlPermission; + m_fileShareDirectoryClient->SetProperties( + Files::Shares::Models::FileSmbProperties(), setOptions); + auto permissionKey + = m_fileShareDirectoryClient->GetProperties().Value.SmbProperties.PermissionKey.Value(); + auto permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + EXPECT_EQ(sddlPermission, permission.Permission); + EXPECT_TRUE(permission.PermissionFormat.HasValue()); + EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + + // Rename File + auto sourceFileName = LowercaseRandomString(); + auto fileClient = m_fileShareDirectoryClient->GetFileClient(sourceFileName); + fileClient.Create(1); + Files::Shares::RenameFileOptions renameOptions; + renameOptions.FilePermissionFormat = permiisionFormat; + renameOptions.FilePermission = sddlPermission; + auto destFileClient + = m_fileShareDirectoryClient + ->RenameFile( + sourceFileName, m_directoryName + "/" + LowercaseRandomString(), renameOptions) + .Value; + permissionKey = destFileClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); + permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + EXPECT_EQ(sddlPermission, permission.Permission); + EXPECT_TRUE(permission.PermissionFormat.HasValue()); + EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + + // Rename Subdirectory + auto sourceDirectoryName = LowercaseRandomString(); + auto subdirectoryClient + = m_fileShareDirectoryClient->GetSubdirectoryClient(sourceDirectoryName); + subdirectoryClient.Create(); + Files::Shares::RenameDirectoryOptions renameDirOptions; + renameDirOptions.FilePermissionFormat = permiisionFormat; + renameDirOptions.FilePermission = sddlPermission; + auto destDirectoryClient = m_fileShareDirectoryClient + ->RenameSubdirectory( + sourceDirectoryName, + m_directoryName + "/" + LowercaseRandomString(), + renameDirOptions) + .Value; + permissionKey = destDirectoryClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); + permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + EXPECT_EQ(sddlPermission, permission.Permission); + EXPECT_TRUE(permission.PermissionFormat.HasValue()); + EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + } + // binary format + { + auto binaryPermission + = "AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/" + "AR8AAQEAAAAAAAUSAAAAAAAYAP8BHwABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAA" + "AABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUAAAAAAAUVAAAAoGXPfnhLm1/nfIdwr/" + "1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA="; + auto permiisionFormat = Files::Shares::Models::FilePermissionFormat::Binary; + // Set Properties + Files::Shares::SetDirectoryPropertiesOptions setOptions; + setOptions.FilePermissionFormat = permiisionFormat; + setOptions.FilePermission = binaryPermission; + m_fileShareDirectoryClient->SetProperties( + Files::Shares::Models::FileSmbProperties(), setOptions); + auto permissionKey + = m_fileShareDirectoryClient->GetProperties().Value.SmbProperties.PermissionKey.Value(); + auto permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + EXPECT_EQ(binaryPermission, permission.Permission); + EXPECT_TRUE(permission.PermissionFormat.HasValue()); + EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + + // Rename File + auto sourceFileName = LowercaseRandomString(); + auto fileClient = m_fileShareDirectoryClient->GetFileClient(sourceFileName); + fileClient.Create(1); + Files::Shares::RenameFileOptions renameOptions; + renameOptions.FilePermissionFormat = permiisionFormat; + renameOptions.FilePermission = binaryPermission; + auto destFileClient + = m_fileShareDirectoryClient + ->RenameFile( + sourceFileName, m_directoryName + "/" + LowercaseRandomString(), renameOptions) + .Value; + permissionKey = destFileClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); + permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + EXPECT_EQ(binaryPermission, permission.Permission); + EXPECT_TRUE(permission.PermissionFormat.HasValue()); + EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + + // Rename Subdirectory + auto sourceDirectoryName = LowercaseRandomString(); + auto subdirectoryClient + = m_fileShareDirectoryClient->GetSubdirectoryClient(sourceDirectoryName); + subdirectoryClient.Create(); + Files::Shares::RenameDirectoryOptions renameDirOptions; + renameDirOptions.FilePermissionFormat = permiisionFormat; + renameDirOptions.FilePermission = binaryPermission; + auto destDirectoryClient = m_fileShareDirectoryClient + ->RenameSubdirectory( + sourceDirectoryName, + m_directoryName + "/" + LowercaseRandomString(), + renameDirOptions) + .Value; + permissionKey = destDirectoryClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); + permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + EXPECT_EQ(binaryPermission, permission.Permission); + EXPECT_TRUE(permission.PermissionFormat.HasValue()); + EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + } + } }}} // namespace Azure::Storage::Test diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp index 505f888c6b..5624d4088c 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp @@ -1859,4 +1859,73 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_EQ(andAccessRights, accessRightsA & accessRightsB); EXPECT_EQ(xorAccessRights, accessRightsA ^ accessRightsB); } + + TEST_F(FileShareFileClientTest, FilePermisionFormat) + { + // sddl format + { + auto sddlPermission + = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-" + "1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-" + "188441444-3053964)S:NO_ACCESS_CONTROL"; + auto permiisionFormat = Files::Shares::Models::FilePermissionFormat::Sddl; + auto fileClient = m_shareClient->GetRootDirectoryClient().GetFileClient(RandomString()); + + // Create + Files::Shares::CreateFileOptions options; + options.FilePermissionFormat = permiisionFormat; + options.Permission = sddlPermission; + auto permissionKey = fileClient.Create(1, options).Value.SmbProperties.PermissionKey.Value(); + auto permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + EXPECT_TRUE(permission.PermissionFormat.HasValue()); + EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + + // Set Properties + Files::Shares::SetFilePropertiesOptions setOptions; + setOptions.FilePermissionFormat = permiisionFormat; + setOptions.Permission = sddlPermission; + fileClient.SetProperties( + Files::Shares::Models::FileHttpHeaders(), + Files::Shares::Models::FileSmbProperties(), + setOptions); + permissionKey = fileClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); + permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + EXPECT_EQ(sddlPermission, permission.Permission); + EXPECT_TRUE(permission.PermissionFormat.HasValue()); + EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + } + // binary format + { + auto binaryPermission + = "AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/" + "AR8AAQEAAAAAAAUSAAAAAAAYAP8BHwABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAA" + "AABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUAAAAAAAUVAAAAoGXPfnhLm1/nfIdwr/" + "1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA="; + auto permiisionFormat = Files::Shares::Models::FilePermissionFormat::Binary; + auto fileClient = m_shareClient->GetRootDirectoryClient().GetFileClient(RandomString()); + + // Create + Files::Shares::CreateFileOptions options; + options.FilePermissionFormat = permiisionFormat; + options.Permission = binaryPermission; + auto permissionKey = fileClient.Create(1, options).Value.SmbProperties.PermissionKey.Value(); + auto permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + EXPECT_TRUE(permission.PermissionFormat.HasValue()); + EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + + // Set Properties + Files::Shares::SetFilePropertiesOptions setOptions; + setOptions.FilePermissionFormat = permiisionFormat; + setOptions.Permission = binaryPermission; + fileClient.SetProperties( + Files::Shares::Models::FileHttpHeaders(), + Files::Shares::Models::FileSmbProperties(), + setOptions); + permissionKey = fileClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); + permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + EXPECT_EQ(binaryPermission, permission.Permission); + EXPECT_TRUE(permission.PermissionFormat.HasValue()); + EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + } + } }}} // namespace Azure::Storage::Test From 112647e8a2680216f99758acddd80bb79585be3a Mon Sep 17 00:00:00 2001 From: microzchang Date: Thu, 18 Jul 2024 18:12:49 +0800 Subject: [PATCH 2/9] update test case to playback only --- .../storage/files/shares/share_client.hpp | 2 +- .../storage/files/shares/share_options.hpp | 30 +++++++++++++++---- .../test/ut/share_client_test.cpp | 2 +- .../test/ut/share_directory_client_test.cpp | 2 +- .../test/ut/share_file_client_test.cpp | 2 +- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp index 70f8141a47..9b0816b802 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp @@ -247,7 +247,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { * @param permissionKey The permission key of a permission. * @param filePermissionFormat Optional. Available for version 2024-11-04 and later. Specifies * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or - * explicityly set to , the permission will be + * explicityly set to SSDL format, the permission will be * returned in SSDL format. * @param options Optional parameters to get share's permission. * @param context Context for cancelling long running operations. diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp index 486f413143..5ab0074eda 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp @@ -312,7 +312,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { struct CreateSharePermissionOptions final { /** - * Format of Permission. + * Optional. Available for version 2024-11-04 and later. Specifies + * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or + * explicityly set to SDDL format, the permission will be + * returned in SSDL format. */ Nullable FilePermissionFormat; }; @@ -392,7 +395,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Azure::Nullable FilePermission; /** - * Format of Permission. + * Optional. Available for version 2024-11-04 and later. Specifies + * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or + * explicityly set to SDDL format, the permission will be + * returned in SSDL format. */ Nullable FilePermissionFormat; @@ -453,7 +459,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Azure::Nullable FilePermission; /** - * Format of Permission. + * Optional. Available for version 2024-11-04 and later. Specifies + * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or + * explicityly set to SDDL format, the permission will be + * returned in SSDL format. */ Nullable FilePermissionFormat; @@ -493,7 +502,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Azure::Nullable FilePermission; /** - * Format of Permission. + * Optional. Available for version 2024-11-04 and later. Specifies + * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or + * explicityly set to SDDL format format, the permission will be + * returned in SSDL format. */ Nullable FilePermissionFormat; }; @@ -615,7 +627,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Azure::Nullable Permission; /** - * Format of Permission. + * Optional. Available for version 2024-11-04 and later. Specifies + * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or + * explicityly set to SDDL format format, the permission will be + * returned in SSDL format. */ Nullable FilePermissionFormat; @@ -753,7 +768,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Azure::Nullable Permission; /** - * Format of Permission. + * Optional. Available for version 2024-11-04 and later. Specifies + * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or + * explicityly set to SDDL format format, the permission will be + * returned in SSDL format. */ Nullable FilePermissionFormat; diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp index 3330ed3a3b..c565e88a64 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp @@ -781,7 +781,7 @@ namespace Azure { namespace Storage { namespace Test { && !properties.EnableSnapshotVirtualDirectoryAccess.Value()); } - TEST_F(FileShareClientTest, FilePermisionFormat) + TEST_F(FileShareClientTest, FilePermisionFormat_PLAYBACKONLY_) { // sddl format { diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp index e844b41fc7..4e647064e7 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp @@ -1230,7 +1230,7 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_THROW(directoryClient.GetProperties(), StorageException); } - TEST_F(FileShareDirectoryClientTest, FilePermisionFormat) + TEST_F(FileShareDirectoryClientTest, FilePermisionFormat_PLAYBACKONLY_) { // sddl format { diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp index 5624d4088c..2f408038b1 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp @@ -1860,7 +1860,7 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_EQ(xorAccessRights, accessRightsA ^ accessRightsB); } - TEST_F(FileShareFileClientTest, FilePermisionFormat) + TEST_F(FileShareFileClientTest, FilePermisionFormat_PLAYBACKONLY_) { // sddl format { From 6ecdaff4ceefa4fa5814e8cacd530e6800cdfbce Mon Sep 17 00:00:00 2001 From: microzchang Date: Thu, 18 Jul 2024 18:13:33 +0800 Subject: [PATCH 3/9] update records --- sdk/storage/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/storage/assets.json b/sdk/storage/assets.json index 1b1d5b97fc..c4096ce3a0 100644 --- a/sdk/storage/assets.json +++ b/sdk/storage/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "cpp", "TagPrefix": "cpp/storage", - "Tag": "cpp/storage_a10995a69c" + "Tag": "cpp/storage_490fe1b8ae" } From 23c821b214d8986c7283a53a78cb5b421c8ffa5c Mon Sep 17 00:00:00 2001 From: microzchang Date: Thu, 18 Jul 2024 20:16:21 +0800 Subject: [PATCH 4/9] fix cspell --- .../storage/files/shares/share_client.hpp | 4 +- .../storage/files/shares/share_options.hpp | 26 +++++------ .../test/ut/share_client_test.cpp | 3 +- .../test/ut/share_directory_client_test.cpp | 43 ++++++++++--------- .../test/ut/share_file_client_test.cpp | 31 ++++++------- 5 files changed, 55 insertions(+), 52 deletions(-) diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp index 9b0816b802..bc75377625 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp @@ -247,8 +247,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { * @param permissionKey The permission key of a permission. * @param filePermissionFormat Optional. Available for version 2024-11-04 and later. Specifies * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or - * explicityly set to SSDL format, the permission will be - * returned in SSDL format. + * explicityly set to SDDL format, the permission will be + * returned in SDDL format. * @param options Optional parameters to get share's permission. * @param context Context for cancelling long running operations. * @return Azure::Response containing the permission string with specified key. diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp index 5ab0074eda..c5e1da7d1e 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp @@ -14,7 +14,7 @@ #include #include -/* cSpell:ignore dacl */ +/* cSpell:ignore dacl sddl*/ namespace Azure { namespace Storage { namespace Files { namespace Shares { @@ -314,8 +314,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { /** * Optional. Available for version 2024-11-04 and later. Specifies * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or - * explicityly set to SDDL format, the permission will be - * returned in SSDL format. + * explicitly set to SDDL format, the permission will be + * returned in SDDL format. */ Nullable FilePermissionFormat; }; @@ -397,8 +397,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { /** * Optional. Available for version 2024-11-04 and later. Specifies * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or - * explicityly set to SDDL format, the permission will be - * returned in SSDL format. + * explicitly set to SDDL format, the permission will be + * returned in SDDL format. */ Nullable FilePermissionFormat; @@ -461,8 +461,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { /** * Optional. Available for version 2024-11-04 and later. Specifies * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or - * explicityly set to SDDL format, the permission will be - * returned in SSDL format. + * explicitly set to SDDL format, the permission will be + * returned in SDDL format. */ Nullable FilePermissionFormat; @@ -504,8 +504,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { /** * Optional. Available for version 2024-11-04 and later. Specifies * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or - * explicityly set to SDDL format format, the permission will be - * returned in SSDL format. + * explicitly set to SDDL format format, the permission will be + * returned in SDDL format. */ Nullable FilePermissionFormat; }; @@ -629,8 +629,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { /** * Optional. Available for version 2024-11-04 and later. Specifies * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or - * explicityly set to SDDL format format, the permission will be - * returned in SSDL format. + * explicitly set to SDDL format format, the permission will be + * returned in SDDL format. */ Nullable FilePermissionFormat; @@ -770,8 +770,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { /** * Optional. Available for version 2024-11-04 and later. Specifies * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or - * explicityly set to SDDL format format, the permission will be - * returned in SSDL format. + * explicitly set to SDDL format format, the permission will be + * returned in SDDL format. */ Nullable FilePermissionFormat; diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp index c565e88a64..19a04e6fba 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp @@ -781,7 +781,8 @@ namespace Azure { namespace Storage { namespace Test { && !properties.EnableSnapshotVirtualDirectoryAccess.Value()); } - TEST_F(FileShareClientTest, FilePermisionFormat_PLAYBACKONLY_) + // cspell:ignore sddl + TEST_F(FileShareClientTest, FilePermissionFormat_PLAYBACKONLY_) { // sddl format { diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp index 4e647064e7..410a7f0de7 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp @@ -1230,7 +1230,8 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_THROW(directoryClient.GetProperties(), StorageException); } - TEST_F(FileShareDirectoryClientTest, FilePermisionFormat_PLAYBACKONLY_) + // cspell:ignore sddl + TEST_F(FileShareDirectoryClientTest, FilePermissionFormat_PLAYBACKONLY_) { // sddl format { @@ -1239,27 +1240,27 @@ namespace Azure { namespace Storage { namespace Test { "1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-" "626881126-" "188441444-3053964)S:NO_ACCESS_CONTROL"; - auto permiisionFormat = Files::Shares::Models::FilePermissionFormat::Sddl; + auto permissionFormat = Files::Shares::Models::FilePermissionFormat::Sddl; // Set Properties Files::Shares::SetDirectoryPropertiesOptions setOptions; - setOptions.FilePermissionFormat = permiisionFormat; + setOptions.FilePermissionFormat = permissionFormat; setOptions.FilePermission = sddlPermission; m_fileShareDirectoryClient->SetProperties( Files::Shares::Models::FileSmbProperties(), setOptions); auto permissionKey = m_fileShareDirectoryClient->GetProperties().Value.SmbProperties.PermissionKey.Value(); - auto permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + auto permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; EXPECT_EQ(sddlPermission, permission.Permission); EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); // Rename File auto sourceFileName = LowercaseRandomString(); auto fileClient = m_fileShareDirectoryClient->GetFileClient(sourceFileName); fileClient.Create(1); Files::Shares::RenameFileOptions renameOptions; - renameOptions.FilePermissionFormat = permiisionFormat; + renameOptions.FilePermissionFormat = permissionFormat; renameOptions.FilePermission = sddlPermission; auto destFileClient = m_fileShareDirectoryClient @@ -1267,10 +1268,10 @@ namespace Azure { namespace Storage { namespace Test { sourceFileName, m_directoryName + "/" + LowercaseRandomString(), renameOptions) .Value; permissionKey = destFileClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); - permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; EXPECT_EQ(sddlPermission, permission.Permission); EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); // Rename Subdirectory auto sourceDirectoryName = LowercaseRandomString(); @@ -1278,7 +1279,7 @@ namespace Azure { namespace Storage { namespace Test { = m_fileShareDirectoryClient->GetSubdirectoryClient(sourceDirectoryName); subdirectoryClient.Create(); Files::Shares::RenameDirectoryOptions renameDirOptions; - renameDirOptions.FilePermissionFormat = permiisionFormat; + renameDirOptions.FilePermissionFormat = permissionFormat; renameDirOptions.FilePermission = sddlPermission; auto destDirectoryClient = m_fileShareDirectoryClient ->RenameSubdirectory( @@ -1287,10 +1288,10 @@ namespace Azure { namespace Storage { namespace Test { renameDirOptions) .Value; permissionKey = destDirectoryClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); - permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; EXPECT_EQ(sddlPermission, permission.Permission); EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); } // binary format { @@ -1299,26 +1300,26 @@ namespace Azure { namespace Storage { namespace Test { "AR8AAQEAAAAAAAUSAAAAAAAYAP8BHwABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAA" "AABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUAAAAAAAUVAAAAoGXPfnhLm1/nfIdwr/" "1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA="; - auto permiisionFormat = Files::Shares::Models::FilePermissionFormat::Binary; + auto permissionFormat = Files::Shares::Models::FilePermissionFormat::Binary; // Set Properties Files::Shares::SetDirectoryPropertiesOptions setOptions; - setOptions.FilePermissionFormat = permiisionFormat; + setOptions.FilePermissionFormat = permissionFormat; setOptions.FilePermission = binaryPermission; m_fileShareDirectoryClient->SetProperties( Files::Shares::Models::FileSmbProperties(), setOptions); auto permissionKey = m_fileShareDirectoryClient->GetProperties().Value.SmbProperties.PermissionKey.Value(); - auto permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + auto permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; EXPECT_EQ(binaryPermission, permission.Permission); EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); // Rename File auto sourceFileName = LowercaseRandomString(); auto fileClient = m_fileShareDirectoryClient->GetFileClient(sourceFileName); fileClient.Create(1); Files::Shares::RenameFileOptions renameOptions; - renameOptions.FilePermissionFormat = permiisionFormat; + renameOptions.FilePermissionFormat = permissionFormat; renameOptions.FilePermission = binaryPermission; auto destFileClient = m_fileShareDirectoryClient @@ -1326,10 +1327,10 @@ namespace Azure { namespace Storage { namespace Test { sourceFileName, m_directoryName + "/" + LowercaseRandomString(), renameOptions) .Value; permissionKey = destFileClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); - permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; EXPECT_EQ(binaryPermission, permission.Permission); EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); // Rename Subdirectory auto sourceDirectoryName = LowercaseRandomString(); @@ -1337,7 +1338,7 @@ namespace Azure { namespace Storage { namespace Test { = m_fileShareDirectoryClient->GetSubdirectoryClient(sourceDirectoryName); subdirectoryClient.Create(); Files::Shares::RenameDirectoryOptions renameDirOptions; - renameDirOptions.FilePermissionFormat = permiisionFormat; + renameDirOptions.FilePermissionFormat = permissionFormat; renameDirOptions.FilePermission = binaryPermission; auto destDirectoryClient = m_fileShareDirectoryClient ->RenameSubdirectory( @@ -1346,10 +1347,10 @@ namespace Azure { namespace Storage { namespace Test { renameDirOptions) .Value; permissionKey = destDirectoryClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); - permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; EXPECT_EQ(binaryPermission, permission.Permission); EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); } } }}} // namespace Azure::Storage::Test diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp index 2f408038b1..a80579777f 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp @@ -1860,7 +1860,8 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_EQ(xorAccessRights, accessRightsA ^ accessRightsB); } - TEST_F(FileShareFileClientTest, FilePermisionFormat_PLAYBACKONLY_) + // cspell:ignore sddl + TEST_F(FileShareFileClientTest, FilePermissionFormat_PLAYBACKONLY_) { // sddl format { @@ -1868,31 +1869,31 @@ namespace Azure { namespace Storage { namespace Test { = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-" "1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-" "188441444-3053964)S:NO_ACCESS_CONTROL"; - auto permiisionFormat = Files::Shares::Models::FilePermissionFormat::Sddl; + auto permissionFormat = Files::Shares::Models::FilePermissionFormat::Sddl; auto fileClient = m_shareClient->GetRootDirectoryClient().GetFileClient(RandomString()); // Create Files::Shares::CreateFileOptions options; - options.FilePermissionFormat = permiisionFormat; + options.FilePermissionFormat = permissionFormat; options.Permission = sddlPermission; auto permissionKey = fileClient.Create(1, options).Value.SmbProperties.PermissionKey.Value(); - auto permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + auto permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); // Set Properties Files::Shares::SetFilePropertiesOptions setOptions; - setOptions.FilePermissionFormat = permiisionFormat; + setOptions.FilePermissionFormat = permissionFormat; setOptions.Permission = sddlPermission; fileClient.SetProperties( Files::Shares::Models::FileHttpHeaders(), Files::Shares::Models::FileSmbProperties(), setOptions); permissionKey = fileClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); - permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; EXPECT_EQ(sddlPermission, permission.Permission); EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); } // binary format { @@ -1901,31 +1902,31 @@ namespace Azure { namespace Storage { namespace Test { "AR8AAQEAAAAAAAUSAAAAAAAYAP8BHwABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAA" "AABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUAAAAAAAUVAAAAoGXPfnhLm1/nfIdwr/" "1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA="; - auto permiisionFormat = Files::Shares::Models::FilePermissionFormat::Binary; + auto permissionFormat = Files::Shares::Models::FilePermissionFormat::Binary; auto fileClient = m_shareClient->GetRootDirectoryClient().GetFileClient(RandomString()); // Create Files::Shares::CreateFileOptions options; - options.FilePermissionFormat = permiisionFormat; + options.FilePermissionFormat = permissionFormat; options.Permission = binaryPermission; auto permissionKey = fileClient.Create(1, options).Value.SmbProperties.PermissionKey.Value(); - auto permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + auto permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); // Set Properties Files::Shares::SetFilePropertiesOptions setOptions; - setOptions.FilePermissionFormat = permiisionFormat; + setOptions.FilePermissionFormat = permissionFormat; setOptions.Permission = binaryPermission; fileClient.SetProperties( Files::Shares::Models::FileHttpHeaders(), Files::Shares::Models::FileSmbProperties(), setOptions); permissionKey = fileClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); - permission = m_shareClient->GetPermission(permissionKey, permiisionFormat).Value; + permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; EXPECT_EQ(binaryPermission, permission.Permission); EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permiisionFormat, permission.PermissionFormat.Value()); + EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); } } }}} // namespace Azure::Storage::Test From 51033e097d318748abcef7a827a126bfa1b1c931 Mon Sep 17 00:00:00 2001 From: microzchang Date: Thu, 18 Jul 2024 20:24:21 +0800 Subject: [PATCH 5/9] update record --- sdk/storage/assets.json | 2 +- .../inc/azure/storage/files/shares/share_client.hpp | 2 +- .../inc/azure/storage/files/shares/share_options.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/storage/assets.json b/sdk/storage/assets.json index c4096ce3a0..cab2cfa56f 100644 --- a/sdk/storage/assets.json +++ b/sdk/storage/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "cpp", "TagPrefix": "cpp/storage", - "Tag": "cpp/storage_490fe1b8ae" + "Tag": "cpp/storage_16d4fe790f" } diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp index bc75377625..fbdf5c37a5 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp @@ -247,7 +247,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { * @param permissionKey The permission key of a permission. * @param filePermissionFormat Optional. Available for version 2024-11-04 and later. Specifies * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or - * explicityly set to SDDL format, the permission will be + * explicitly set to SDDL format, the permission will be * returned in SDDL format. * @param options Optional parameters to get share's permission. * @param context Context for cancelling long running operations. diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp index c5e1da7d1e..924530c300 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp @@ -14,7 +14,7 @@ #include #include -/* cSpell:ignore dacl sddl*/ +/* cSpell:ignore dacl, sddl*/ namespace Azure { namespace Storage { namespace Files { namespace Shares { From 9e701577508ff08690c620d09fa2762018080cb3 Mon Sep 17 00:00:00 2001 From: microzchang Date: Thu, 18 Jul 2024 20:28:45 +0800 Subject: [PATCH 6/9] fix cspell --- .../inc/azure/storage/files/shares/share_options.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp index 924530c300..17cb8086c4 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp @@ -14,8 +14,7 @@ #include #include -/* cSpell:ignore dacl, sddl*/ - +// cspell:ignore dacl sddl namespace Azure { namespace Storage { namespace Files { namespace Shares { /** From ee2faf6bf1bb39458581f5237b0f6cdc73c98605 Mon Sep 17 00:00:00 2001 From: microzchang Date: Thu, 18 Jul 2024 20:34:39 +0800 Subject: [PATCH 7/9] fix cspell --- .vscode/cspell.json | 2 ++ .../inc/azure/storage/files/shares/share_options.hpp | 3 ++- .../azure-storage-files-shares/test/ut/share_client_test.cpp | 1 - .../test/ut/share_directory_client_test.cpp | 1 - .../test/ut/share_file_client_test.cpp | 1 - 5 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 21c218a116..0adc040a35 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -225,6 +225,8 @@ "Schulze", "scus", "SDDL", + "Sddl", + "sddl", "sdpath", "serializers", "Seriot", diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp index 17cb8086c4..9fee179683 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp @@ -14,7 +14,8 @@ #include #include -// cspell:ignore dacl sddl +/* cSpell:ignore dacl */ + namespace Azure { namespace Storage { namespace Files { namespace Shares { /** diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp index 19a04e6fba..bbcdead966 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp @@ -781,7 +781,6 @@ namespace Azure { namespace Storage { namespace Test { && !properties.EnableSnapshotVirtualDirectoryAccess.Value()); } - // cspell:ignore sddl TEST_F(FileShareClientTest, FilePermissionFormat_PLAYBACKONLY_) { // sddl format diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp index 410a7f0de7..b7bfc848cc 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp @@ -1230,7 +1230,6 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_THROW(directoryClient.GetProperties(), StorageException); } - // cspell:ignore sddl TEST_F(FileShareDirectoryClientTest, FilePermissionFormat_PLAYBACKONLY_) { // sddl format diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp index a80579777f..963ef59b8f 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp @@ -1860,7 +1860,6 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_EQ(xorAccessRights, accessRightsA ^ accessRightsB); } - // cspell:ignore sddl TEST_F(FileShareFileClientTest, FilePermissionFormat_PLAYBACKONLY_) { // sddl format From 7fc0b3b5452e6f0fc2a07d31f2ca1c122d65bf17 Mon Sep 17 00:00:00 2001 From: microzchang Date: Fri, 19 Jul 2024 11:13:59 +0800 Subject: [PATCH 8/9] fix comments --- sdk/storage/assets.json | 2 +- .../storage/files/shares/share_client.hpp | 17 ------ .../storage/files/shares/share_options.hpp | 7 +++ .../storage/files/shares/share_responses.hpp | 17 ------ .../src/share_client.cpp | 22 +------ .../test/ut/share_client_test.cpp | 51 ++++++++-------- .../test/ut/share_directory_client_test.cpp | 58 ++++++++----------- .../test/ut/share_file_client_test.cpp | 52 +++++++++-------- 8 files changed, 87 insertions(+), 139 deletions(-) diff --git a/sdk/storage/assets.json b/sdk/storage/assets.json index cab2cfa56f..ea934e0225 100644 --- a/sdk/storage/assets.json +++ b/sdk/storage/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "cpp", "TagPrefix": "cpp/storage", - "Tag": "cpp/storage_16d4fe790f" + "Tag": "cpp/storage_3a6c7a0852" } diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp index fbdf5c37a5..2741369d21 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp @@ -242,23 +242,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { const GetSharePermissionOptions& options = GetSharePermissionOptions(), const Azure::Core::Context& context = Azure::Core::Context()) const; - /** - * @brief Gets the permission of the share using the specific key. - * @param permissionKey The permission key of a permission. - * @param filePermissionFormat Optional. Available for version 2024-11-04 and later. Specifies - * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or - * explicitly set to SDDL format, the permission will be - * returned in SDDL format. - * @param options Optional parameters to get share's permission. - * @param context Context for cancelling long running operations. - * @return Azure::Response containing the permission string with specified key. - */ - Azure::Response GetPermission( - const std::string& permissionKey, - const Nullable filePermissionFormat, - const GetSharePermissionOptions& options = GetSharePermissionOptions(), - const Azure::Core::Context& context = Azure::Core::Context()) const; - private: Azure::Core::Url m_shareUrl; std::shared_ptr m_pipeline; diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp index 9fee179683..5b259477e0 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp @@ -325,6 +325,13 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ struct GetSharePermissionOptions final { + /** + * Optional. Available for version 2024-11-04 and later. Specifies + * the format in which the permission is returned.If filePermissionKeyFormat is unspecified or + * explicitly set to SDDL format, the permission will be + * returned in SDDL format. + */ + Nullable FilePermissionFormat; }; /** diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp index 5a471a2450..ae875ca949 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp @@ -317,23 +317,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ Azure::Nullable AccessRights; }; - - /** - * @brief A permission at the share level. - */ - struct ShareFilePermission final - { - /** - * The permission in the Security Descriptor Definition Language (SDDL) or base64 encoded - * binary format. - */ - std::string Permission; - - /** - * Format of Permission. - */ - Nullable PermissionFormat; - }; } // namespace Models /** diff --git a/sdk/storage/azure-storage-files-shares/src/share_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_client.cpp index d65b66e51e..01f3660e58 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_client.cpp @@ -332,34 +332,14 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { const GetSharePermissionOptions& options, const Azure::Core::Context& context) const { - (void)options; auto protocolLayerOptions = _detail::ShareClient::GetSharePermissionOptions(); protocolLayerOptions.FilePermissionKey = permissionKey; protocolLayerOptions.FileRequestIntent = m_shareTokenIntent; + protocolLayerOptions.FilePermissionFormat = options.FilePermissionFormat; auto result = _detail::ShareClient::GetPermission( *m_pipeline, m_shareUrl, protocolLayerOptions, context); return Azure::Response(result.Value.Permission, std::move(result.RawResponse)); } - Azure::Response ShareClient::GetPermission( - const std::string& permissionKey, - const Nullable filePermissionFormat, - const GetSharePermissionOptions& options, - const Azure::Core::Context& context) const - { - (void)options; - auto protocolLayerOptions = _detail::ShareClient::GetSharePermissionOptions(); - protocolLayerOptions.FilePermissionKey = permissionKey; - protocolLayerOptions.FileRequestIntent = m_shareTokenIntent; - protocolLayerOptions.FilePermissionFormat = filePermissionFormat; - auto result = _detail::ShareClient::GetPermission( - *m_pipeline, m_shareUrl, protocolLayerOptions, context); - Models::ShareFilePermission ret; - ret.Permission = std::move(result.Value.Permission); - ret.PermissionFormat = result.Value.Format; - return Azure::Response( - std::move(ret), std::move(result.RawResponse)); - } - }}}} // namespace Azure::Storage::Files::Shares diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp index bbcdead966..0c61e3b0b3 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_client_test.cpp @@ -783,44 +783,43 @@ namespace Azure { namespace Storage { namespace Test { TEST_F(FileShareClientTest, FilePermissionFormat_PLAYBACKONLY_) { + auto sddlPermission + = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-" + "1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-" + "188441444-3053964)S:NO_ACCESS_CONTROL"; + auto binaryPermission = "AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/" + "AR8AAQEAAAAAAAUSAAAAAAAYAP8BHwABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAA" + "AABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUAAAAAAAUVAAAAoGXPfnhLm1/nfIdwr/" + "1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA="; // sddl format { - auto sddlPermission - = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-" - "1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-" - "188441444-3053964)S:NO_ACCESS_CONTROL"; + auto permissionFormat = Files::Shares::Models::FilePermissionFormat::Sddl; Files::Shares::CreateSharePermissionOptions options; - options.FilePermissionFormat = Files::Shares::Models::FilePermissionFormat::Sddl; + options.FilePermissionFormat = permissionFormat; auto permissionKey = m_shareClient->CreatePermission(sddlPermission, options).Value.FilePermissionKey; - auto permission - = m_shareClient - ->GetPermission(permissionKey, Files::Shares::Models::FilePermissionFormat::Sddl) - .Value; - EXPECT_EQ(sddlPermission, permission.Permission); - EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ( - Files::Shares::Models::FilePermissionFormat::Sddl, permission.PermissionFormat.Value()); + Files::Shares::GetSharePermissionOptions getOptions; + getOptions.FilePermissionFormat = permissionFormat; + auto permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(sddlPermission, permission); + getOptions.FilePermissionFormat = Files::Shares::Models::FilePermissionFormat::Binary; + permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(binaryPermission, permission); } // binary format { - auto binaryPermission - = "AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/" - "AR8AAQEAAAAAAAUSAAAAAAAYAP8BHwABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAA" - "AABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUAAAAAAAUVAAAAoGXPfnhLm1/nfIdwr/" - "1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA="; + auto permissionFormat = Files::Shares::Models::FilePermissionFormat::Binary; Files::Shares::CreateSharePermissionOptions options; options.FilePermissionFormat = Files::Shares::Models::FilePermissionFormat::Binary; auto permissionKey = m_shareClient->CreatePermission(binaryPermission, options).Value.FilePermissionKey; - auto permission - = m_shareClient - ->GetPermission(permissionKey, Files::Shares::Models::FilePermissionFormat::Binary) - .Value; - EXPECT_EQ(binaryPermission, permission.Permission); - EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ( - Files::Shares::Models::FilePermissionFormat::Binary, permission.PermissionFormat.Value()); + Files::Shares::GetSharePermissionOptions getOptions; + getOptions.FilePermissionFormat = permissionFormat; + auto permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(binaryPermission, permission); + getOptions.FilePermissionFormat = Files::Shares::Models::FilePermissionFormat::Sddl; + permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(sddlPermission, permission); } } }}} // namespace Azure::Storage::Test diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp index b7bfc848cc..b743d0ae5c 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_directory_client_test.cpp @@ -1232,13 +1232,16 @@ namespace Azure { namespace Storage { namespace Test { TEST_F(FileShareDirectoryClientTest, FilePermissionFormat_PLAYBACKONLY_) { + auto sddlPermission + = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-" + "1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-" + "188441444-3053964)S:NO_ACCESS_CONTROL"; + auto binaryPermission = "AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/" + "AR8AAQEAAAAAAAUSAAAAAAAYAP8BHwABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAA" + "AABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUAAAAAAAUVAAAAoGXPfnhLm1/nfIdwr/" + "1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA="; // sddl format { - auto sddlPermission - = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-" - "1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-" - "626881126-" - "188441444-3053964)S:NO_ACCESS_CONTROL"; auto permissionFormat = Files::Shares::Models::FilePermissionFormat::Sddl; // Set Properties @@ -1249,10 +1252,10 @@ namespace Azure { namespace Storage { namespace Test { Files::Shares::Models::FileSmbProperties(), setOptions); auto permissionKey = m_fileShareDirectoryClient->GetProperties().Value.SmbProperties.PermissionKey.Value(); - auto permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; - EXPECT_EQ(sddlPermission, permission.Permission); - EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); + Files::Shares::GetSharePermissionOptions getOptions; + getOptions.FilePermissionFormat = permissionFormat; + auto permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(sddlPermission, permission); // Rename File auto sourceFileName = LowercaseRandomString(); @@ -1267,10 +1270,8 @@ namespace Azure { namespace Storage { namespace Test { sourceFileName, m_directoryName + "/" + LowercaseRandomString(), renameOptions) .Value; permissionKey = destFileClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); - permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; - EXPECT_EQ(sddlPermission, permission.Permission); - EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); + permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(sddlPermission, permission); // Rename Subdirectory auto sourceDirectoryName = LowercaseRandomString(); @@ -1287,18 +1288,11 @@ namespace Azure { namespace Storage { namespace Test { renameDirOptions) .Value; permissionKey = destDirectoryClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); - permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; - EXPECT_EQ(sddlPermission, permission.Permission); - EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); + permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(sddlPermission, permission); } // binary format { - auto binaryPermission - = "AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/" - "AR8AAQEAAAAAAAUSAAAAAAAYAP8BHwABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAA" - "AABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUAAAAAAAUVAAAAoGXPfnhLm1/nfIdwr/" - "1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA="; auto permissionFormat = Files::Shares::Models::FilePermissionFormat::Binary; // Set Properties Files::Shares::SetDirectoryPropertiesOptions setOptions; @@ -1308,10 +1302,10 @@ namespace Azure { namespace Storage { namespace Test { Files::Shares::Models::FileSmbProperties(), setOptions); auto permissionKey = m_fileShareDirectoryClient->GetProperties().Value.SmbProperties.PermissionKey.Value(); - auto permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; - EXPECT_EQ(binaryPermission, permission.Permission); - EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); + Files::Shares::GetSharePermissionOptions getOptions; + getOptions.FilePermissionFormat = permissionFormat; + auto permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(binaryPermission, permission); // Rename File auto sourceFileName = LowercaseRandomString(); @@ -1326,10 +1320,8 @@ namespace Azure { namespace Storage { namespace Test { sourceFileName, m_directoryName + "/" + LowercaseRandomString(), renameOptions) .Value; permissionKey = destFileClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); - permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; - EXPECT_EQ(binaryPermission, permission.Permission); - EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); + permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(binaryPermission, permission); // Rename Subdirectory auto sourceDirectoryName = LowercaseRandomString(); @@ -1346,10 +1338,8 @@ namespace Azure { namespace Storage { namespace Test { renameDirOptions) .Value; permissionKey = destDirectoryClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); - permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; - EXPECT_EQ(binaryPermission, permission.Permission); - EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); + permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(binaryPermission, permission); } } }}} // namespace Azure::Storage::Test diff --git a/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp index 963ef59b8f..024f79d3fd 100644 --- a/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/ut/share_file_client_test.cpp @@ -1862,12 +1862,25 @@ namespace Azure { namespace Storage { namespace Test { TEST_F(FileShareFileClientTest, FilePermissionFormat_PLAYBACKONLY_) { + auto sddlPermission + = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-" + "1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-" + "188441444-3053964)S:NO_ACCESS_CONTROL"; + auto sddlPermissionNoControlFlag + = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-" + "1887927527-513D:(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-" + "188441444-3053964)"; + auto binaryPermission = "AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/" + "AR8AAQEAAAAAAAUSAAAAAAAYAP8BHwABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAA" + "AABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUAAAAAAAUVAAAAoGXPfnhLm1/nfIdwr/" + "1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA="; + auto binaryPermissionNoControlFlag + = "AQAEgGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/" + "AR8AAQEAAAAAAAUSAAAAAAAYAP8BHwABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAAAABRUAAABZUbgXZnJd" + "JWRjOwuMmS4AAQUAAAAAAAUVAAAAoGXPfnhLm1/nfIdwr/" + "1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA="; // sddl format { - auto sddlPermission - = "O:S-1-5-21-2127521184-1604012920-1887927527-21560751G:S-1-5-21-2127521184-1604012920-" - "1887927527-513D:AI(A;;FA;;;SY)(A;;FA;;;BA)(A;;0x1200a9;;;S-1-5-21-397955417-626881126-" - "188441444-3053964)S:NO_ACCESS_CONTROL"; auto permissionFormat = Files::Shares::Models::FilePermissionFormat::Sddl; auto fileClient = m_shareClient->GetRootDirectoryClient().GetFileClient(RandomString()); @@ -1876,9 +1889,10 @@ namespace Azure { namespace Storage { namespace Test { options.FilePermissionFormat = permissionFormat; options.Permission = sddlPermission; auto permissionKey = fileClient.Create(1, options).Value.SmbProperties.PermissionKey.Value(); - auto permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; - EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); + Files::Shares::GetSharePermissionOptions getOptions; + getOptions.FilePermissionFormat = permissionFormat; + auto permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(sddlPermissionNoControlFlag, permission); // Set Properties Files::Shares::SetFilePropertiesOptions setOptions; @@ -1889,18 +1903,11 @@ namespace Azure { namespace Storage { namespace Test { Files::Shares::Models::FileSmbProperties(), setOptions); permissionKey = fileClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); - permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; - EXPECT_EQ(sddlPermission, permission.Permission); - EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); + permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(sddlPermission, permission); } // binary format { - auto binaryPermission - = "AQAUhGwAAACIAAAAAAAAABQAAAACAFgAAwAAAAAAFAD/" - "AR8AAQEAAAAAAAUSAAAAAAAYAP8BHwABAgAAAAAABSAAAAAgAgAAAAAkAKkAEgABBQAAAA" - "AABRUAAABZUbgXZnJdJWRjOwuMmS4AAQUAAAAAAAUVAAAAoGXPfnhLm1/nfIdwr/" - "1IAQEFAAAAAAAFFQAAAKBlz354S5tf53yHcAECAAA="; auto permissionFormat = Files::Shares::Models::FilePermissionFormat::Binary; auto fileClient = m_shareClient->GetRootDirectoryClient().GetFileClient(RandomString()); @@ -1909,9 +1916,10 @@ namespace Azure { namespace Storage { namespace Test { options.FilePermissionFormat = permissionFormat; options.Permission = binaryPermission; auto permissionKey = fileClient.Create(1, options).Value.SmbProperties.PermissionKey.Value(); - auto permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; - EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); + Files::Shares::GetSharePermissionOptions getOptions; + getOptions.FilePermissionFormat = permissionFormat; + auto permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(binaryPermissionNoControlFlag, permission); // Set Properties Files::Shares::SetFilePropertiesOptions setOptions; @@ -1922,10 +1930,8 @@ namespace Azure { namespace Storage { namespace Test { Files::Shares::Models::FileSmbProperties(), setOptions); permissionKey = fileClient.GetProperties().Value.SmbProperties.PermissionKey.Value(); - permission = m_shareClient->GetPermission(permissionKey, permissionFormat).Value; - EXPECT_EQ(binaryPermission, permission.Permission); - EXPECT_TRUE(permission.PermissionFormat.HasValue()); - EXPECT_EQ(permissionFormat, permission.PermissionFormat.Value()); + permission = m_shareClient->GetPermission(permissionKey, getOptions).Value; + EXPECT_EQ(binaryPermission, permission); } } }}} // namespace Azure::Storage::Test From ce0dfcb61ac4e81581f070a74d17b6e118d83bb9 Mon Sep 17 00:00:00 2001 From: microzchang Date: Mon, 22 Jul 2024 10:54:03 +0800 Subject: [PATCH 9/9] Remove copy opreation rest code. --- .../inc/azure/storage/files/shares/rest_client.hpp | 1 - sdk/storage/azure-storage-files-shares/src/rest_client.cpp | 6 ------ 2 files changed, 7 deletions(-) diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp index d0ca4e7503..645724feef 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/rest_client.hpp @@ -2680,7 +2680,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { std::map Metadata; std::string CopySource; Nullable FilePermission; - Nullable FilePermissionFormat; Nullable FilePermissionKey; Nullable FilePermissionCopyMode; Nullable IgnoreReadOnly; diff --git a/sdk/storage/azure-storage-files-shares/src/rest_client.cpp b/sdk/storage/azure-storage-files-shares/src/rest_client.cpp index 6b308a857a..b8d07192c9 100644 --- a/sdk/storage/azure-storage-files-shares/src/rest_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/rest_client.cpp @@ -4113,12 +4113,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { { request.SetHeader("x-ms-file-permission", options.FilePermission.Value()); } - if (options.FilePermissionFormat.HasValue() - && !options.FilePermissionFormat.Value().ToString().empty()) - { - request.SetHeader( - "x-ms-file-permission-format", options.FilePermissionFormat.Value().ToString()); - } if (options.FilePermissionKey.HasValue() && !options.FilePermissionKey.Value().empty()) { request.SetHeader("x-ms-file-permission-key", options.FilePermissionKey.Value());