Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

CosmosDB: implemented Permissions

Compare
Choose a tag to compare
@MindFlavor MindFlavor released this 10 Jan 19:38
· 153 commits to master since this release
688ad3f

Implemented features

  • All the Permission REST APIs methods have been implemented.
  • A new specific client has been created: PermissionClient.
  • Modified the authentication code to accept seamlessly either the master tokens (the one you get from the Azure Portal) and the user permission tokens (the one you get by explicitly granting access to a resource). Please refer to the examples as usual for how to create and use user permission tokens.

Breaking changes

  • Removed enum azure_sdk_cosmos::TokenType
  • Refactored struct azure_sdk_cosmos::AuthorizationToken into an enum to properly handle the permission based token. It also loses the account information (which goes into the azure_sdk_cosmos::Client struct instead). In practice you should replace in your code:
let authorization_token = AuthorizationToken::new(account, TokenType::Master, &master_key)?;	
let client = ClientBuilder::new(authorization_token)?;

with:

let authorization_token = AuthorizationToken::new_master(&master_key)?;
let client = ClientBuilder::new(account, authorization_token)?;

The other variant can be constructed from a azure_sdk_cosmos::PermissionToken struct (regardless on how obtained). For example:

    let new_authorization_token: AuthorizationToken = create_permission_response
        .permission
        .permission_token
        .into();

Issues closed