Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update group alias by ID #4237

Merged
merged 2 commits into from
Apr 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions vault/identity_store_group_aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func groupAliasPaths(i *IdentityStore) []*framework.Path {
},
},
Callbacks: map[logical.Operation]framework.OperationFunc{
logical.UpdateOperation: i.pathGroupAliasIDUpdate(),
logical.ReadOperation: i.pathGroupAliasIDRead(),
logical.DeleteOperation: i.pathGroupAliasIDDelete(),
},
Expand Down
17 changes: 17 additions & 0 deletions vault/identity_store_group_aliases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,23 @@ func TestIdentityStore_GroupAliases_CRUD(t *testing.T) {
t.Fatalf("bad: group alias: %#v\n", resp.Data)
}

resp, err = i.HandleRequest(context.Background(), &logical.Request{
Path: "group-alias/id/" + groupAliasID,
Operation: logical.UpdateOperation,
Data: map[string]interface{}{
"name": "testupdatedgroupaliasname",
"mount_accessor": accessor,
"canonical_id": groupID,
"mount_type": "ldap",
},
})
if err != nil || (resp != nil && resp.IsError()) {
t.Fatalf("bad: err: %v; resp: %#v", err, resp)
}
if resp.Data["id"].(string) != groupAliasID {
t.Fatalf("bad: group alias: %#v\n", resp.Data)
}

groupAliasReq.Operation = logical.DeleteOperation
resp, err = i.HandleRequest(context.Background(), groupAliasReq)
if err != nil || (resp != nil && resp.IsError()) {
Expand Down
50 changes: 50 additions & 0 deletions website/source/api/secret/identity/group-alias.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,56 @@ $ curl \
}
```

## Update Group Alias by ID

This endpoint is used to update an existing group alias.

| Method | Path | Produces |
| :------- | :-------------------------------- | :--------------------- |
| `POST` | `/identity/group-alias/id/:id` | `200 application/json` |

### Parameters

- `id` `(string: <optional>)` - ID of the group alias.

- `name` `(string: entity-<UUID>)` – Name of the group alias.

- `mount_accessor` `(string: "")` – Mount accessor to which this alias belongs
toMount accessor to which this alias belongs to.

- `canonical_id` `(string: "")` - ID of the group to which this is an alias.

### Sample Payload

```json
{
"canonical_id": "b86920ea-2831-00ff-15c5-a3f923f1ee3b",
"mount_accessor": "auth_github_232a90dc",
"name": "dev-team"
}
```

### Sample Request

```
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
--data @payload.json \
http://127.0.0.1:8200/v1/identity/group-alias/id/ca726050-d8ac-6f1f-4210-3b5c5b613824
```

### Sample Response

```json
{
"data": {
"canonical_id": "b86920ea-2831-00ff-15c5-a3f923f1ee3b",
"id": "ca726050-d8ac-6f1f-4210-3b5c5b613824"
}
}
```

## Read Group Alias by ID

This endpoint queries the group alias by its identifier.
Expand Down