Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Commit 4c1368a

Browse files
authored
Merge pull request #449 from keithhc2/od-security-roles-mapping
Updated to include instructions on how to map opendistro_security_roles
2 parents 07d4355 + dc88e4c commit 4c1368a

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

docs/security/access-control/api.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,15 @@ DELETE _opendistro/_security/api/internalusers/<username>
402402

403403
Creates or replaces the specified user. You must specify either `password` (plain text) or `hash` (the hashed user password). If you specify `password`, the security plugin automatically hashes the password before storing it.
404404

405+
Note that any role you supply in the `opendistro_security_roles` array must already exist for the security plugin to map the user to that role. To see predefined roles, refer to [the list of predefined roles](../users-roles/#predefined-roles). For instructions on how to create a role, refer to [creating a role](./#create-role).
406+
405407
#### Request
406408

407409
```json
408410
PUT _opendistro/_security/api/internalusers/<username>
409411
{
410412
"password": "kirkpass",
413+
"opendistro_security_roles": ["maintenance_staff", "weapons"],
411414
"backend_roles": ["captains", "starfleet"],
412415
"attributes": {
413416
"attribute1": "value1",
@@ -428,7 +431,7 @@ PUT _opendistro/_security/api/internalusers/<username>
428431

429432
### Patch user
430433

431-
Updates individual attributes of an internal user.
434+
Updates individual attributes of an internal user.
432435

433436
#### Request
434437

@@ -438,6 +441,9 @@ PATCH _opendistro/_security/api/internalusers/<username>
438441
{
439442
"op": "replace", "path": "/backend_roles", "value": ["klingons"]
440443
},
444+
{
445+
"op": "replace", "path": "/opendistro_security_roles", "value": ["ship_manager"]
446+
},
441447
{
442448
"op": "replace", "path": "/attributes", "value": { "newattribute": "newvalue" }
443449
}

docs/security/access-control/users-roles.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Unless you need to create new [read-only or hidden users](../api/#read-only-and-
2626

2727
## Create users
2828

29-
You can create users using Kibana, `internal_users.yml`, or the REST API.
29+
You can create users using Kibana, `internal_users.yml`, or the REST API. When creating a user, you can map users to roles using `internal_users.yml` or the REST API, but that feature is not currently available in Kibana.
3030

3131
### Kibana
3232

@@ -38,7 +38,6 @@ You can create users using Kibana, `internal_users.yml`, or the REST API.
3838

3939
1. Choose **Submit**.
4040

41-
4241
### internal_users.yml
4342

4443
See [YAML files](../../configuration/yaml/#internal_usersyml).
@@ -77,11 +76,10 @@ See [Create role](../api/#create-role).
7776

7877
## Map users to roles
7978

80-
After creating roles, you map users (or backend roles) to them. Intuitively, people often think of this process as giving a user one or more roles, but in the security plugin, the process is reversed; you select a role and then map one or more users to it.
79+
If you didn't specify roles when you created your user, you can map roles to it afterwards.
8180

8281
Just like users and roles, you create role mappings using Kibana, `roles_mapping.yml`, or the REST API.
8382

84-
8583
### Kibana
8684

8785
1. Choose **Security**, **Roles**, and a role.

docs/security/configuration/yaml.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ new-user:
3434
reserved: false
3535
hidden: false
3636
opendistro_security_roles:
37-
- "some-security-role"
37+
- "specify-some-security-role-here"
3838
backend_roles:
39-
- "some-backend-role"
39+
- "specify-some-backend-role-here"
4040
attributes:
4141
attribute1: "value1"
4242
static: false

0 commit comments

Comments
 (0)