Skip to content

Commit

Permalink
docs: add Custom Applications multiple permissions docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kark committed Sep 15, 2022
1 parent d58a2cb commit 2e3ad2b
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 1 deletion.
58 changes: 57 additions & 1 deletion website/src/content/api-reference/application-config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ You can have "view-only" or "manage-only" OAuth Scopes and leave the other list

## `oAuthScopes.view`

A list of "view-only" [OAuth Scopes](https://docs.commercetools.com/api/scopes) required by the Custom Application and associated to the `View` permission.
A list of "view-only" [OAuth Scopes](https://docs.commercetools.com/api/scopes) required by the Custom Application and associated with the `View` permission.

```json
{
Expand Down Expand Up @@ -355,6 +355,62 @@ Using `manage_` OAuth Scopes always imply the corresponding `view_` OAuth Scope.

</Info>

## `additionalOAuthScopes`

The configuration for [additional OAuth Scopes and user permissions](/concepts/oauth-scopes-and-user-permissions#additional-oauth-scopes) extending [oAuthScopes configuration](#oauthscopes).

## `additionalOAuthScopes.name`

A name used to build the permission keys based on the default permissions pair.

## `additionalOAuthScopes.view`

A list of "view-only" [OAuth Scopes](https://docs.commercetools.com/api/scopes) required by the Custom Application and associated with the `View` permission scoped to the respective permission group.

```json
{
"additionalOAuthScopes": [
{
"name": "movies",
"view": ["view_products"],
"manage": []
},
{
"name": "merch",
"view": ["view_categories"],
"manage": []
}
]
}
```

## `additionalOAuthScopes.manage`

A list of "manage-only" [OAuth Scopes](https://docs.commercetools.com/api/scopes) required by the Custom Application and associated with the `Manage` permission scoped to the respective permission group.

```json
{
"additionalOAuthScopes": [
{
"name": "movies",
"view": [],
"manage": ["manage_products"]
},
{
"name": "merch",
"view": [],
"manage": ["manage_categories"]
}
]
}
```

<Info>

Using `manage_` OAuth Scopes always imply the corresponding `view_` OAuth Scope.

</Info>

## `headers`

An optional object to configure HTTP headers used by the Custom Application.
Expand Down
31 changes: 31 additions & 0 deletions website/src/content/concepts/oauth-scopes-and-user-permissions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,37 @@ Notice here how the OAuth Scopes are grouped by the two fields `view` and `manag

This grouping determines the **mapping and relation between OAuth Scopes and user permissions**.

# Additional OAuth Scopes

Defining `oAuthScopes` in the Custom Application config allows using permissions limited to 1 unique pair (view/manage) specific to the Custom Application.

For more granular permissions, for example, to allow the team access to only certain parts or functionality of the Custom Application, [additional OAuth Scopes](https://docs.commercetools.com/api/scopes) can be requested as part of various permission groups.

These additional OAuth Scopes must be specified in your Custom Application config, using the [`additionalOAuthScopes` field](/api-reference/application-config#additionaloauthscopes).

In the following example, permission group named `team_a` allows to manage orders but not see discount codes, while permission group named `team_b` allows both.

```json title="custom-application-config.json" highlightLines="6-17"
{
"oAuthScopes": {
"view": ["view_products", "view_customers"],
"manage": ["manage_products"]
},
"additionalOAuthScopes": [
{
"name": "team_a",
"view": [],
"manage": ["manage_orders"]
},
{
"name": "team_b",
"view": ["view_discount_codes"],
"manage": ["manage_orders"]
}
]
}
```

# User permissions

In the Merchant Center, you can assign user permissions to Teams to grant or restrict access to certain parts and functionalities of the Merchant Center. See [user permissions in Merchant Center](https://docs.commercetools.com/merchant-center/user-permissions) for more information.<br />
Expand Down

0 comments on commit 2e3ad2b

Please sign in to comment.