Skip to content

Commit

Permalink
Fixed permission link generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Willey committed Jan 16, 2020
1 parent 6d68fa9 commit e77e263
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public PermissionProperties(string id,
this.ResourceUri = ((ContainerInlineCore)container).ClientContext.CreateLink(
parentLink: ((ContainerInlineCore)container).LinkUri.OriginalString,
uriPathSegment: Paths.DocumentsPathSegment,
id: id).OriginalString;
id: itemId).OriginalString;
this.InternalResourcePartitionKey = resourcePartitionKey.InternalKey;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,16 @@ public async Task ItemResourcePermissionTest()
//delete resource with PermissionMode.Read
using (CosmosClient tokenCosmosClient = TestCommon.CreateCosmosClient(clientOptions: null, resourceToken: permission.Token))
{
Container tokenContainer = tokenCosmosClient.GetContainer(this.cosmosDatabase.Id, containerId);
ItemResponse<dynamic> readPermissionItem = await tokenContainer.ReadItemAsync<dynamic>(itemId, partitionKey);
Assert.AreEqual(itemId, readPermissionItem.Resource.id.ToString());

try
{
ItemResponse<dynamic> response = await tokenCosmosClient
.GetDatabase(this.cosmosDatabase.Id)
.GetContainer(containerId)
.DeleteItemAsync<dynamic>(itemId, partitionKey);
ItemResponse<dynamic> response = await tokenContainer.DeleteItemAsync<dynamic>(
itemId,
partitionKey);

Assert.Fail();
}
catch (CosmosException ex)
Expand Down
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [#1105](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1105) Custom serializer no longer calls SDK owned types that would cause serialization exceptions
- [#1116](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1116) Fixed a deadlock on scenarios with SynchronizationContext while executing async query operations
- [#1143](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1143) Fixed authorization issue when doing a query with resource token for a specific partition key
- [#1143](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1143) Fixed permission resource link and authorization issue when doing a query with resource token for a specific partition key

## <a name="3.5.1"/> [3.5.1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.5.1) - 2019-12-11

Expand Down

0 comments on commit e77e263

Please sign in to comment.