# How to give more than one condition based to user for the specifc role

**URL:** <https://discuss.elastic.co/t/how-to-give-more-than-one-condition-based-to-user-for-the-specifc-role/61024>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [September 20, 2016, 3:15pm UTC](https://discuss.elastic.co/t/how-to-give-more-than-one-condition-based-to-user-for-the-specifc-role/61024 "2016-09-20T15:15:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![balubollam](https://avatars.discourse-cdn.com/v4/letter/b/a587f6/32.png) [@balubollam](https://discuss.elastic.co/u/balubollam)\
**Post date:** [September 20, 2016, 3:15pm UTC](https://discuss.elastic.co/t/how-to-give-more-than-one-condition-based-to-user-for-the-specifc-role/61024/1 "2016-09-20T15:15:59Z")

</div>

Hi everyone,

Iam using kibana4.5.4,elasticsearch2.3.3,shield2.3.3

Iam trying document i.e query level acces for different values according to the users  
\*in our data we have  
"designation":"developer"  
"designation":"tester"

So we need acces for "developerUSER" username when "designation":"developer" with rolename"A"  
similarly we need acces for "TesterUSER" username when "designation":"Tester" with rolename"A"

###To obtain the above we did  
\*I created custom role "kibana"  
POST /\_shield/role/kibana  
{  
"cluster": ["all"],  
"indices": [  
{  
"names": [".kibana"],  
"privileges": ["all"]  
}  
]  
}

\*create a custom role for developer  
POST /\_shield/role/A  
{  
"cluster": ["all"],  
"indices": [  
{  
"names": ["myindex"],  
"privileges": ["all"],  
"query": "{"match": {"designation": "/developer"}}"  
}  
]  
}

\*create a user for developer

POST /\_shield/user/developerUSER  
{  
"password" : "test123",  
"roles" : ["A","kibana"],  
"full\_name" : "query reader",  
"email" : "balu@ktree.com",  
"metadata" : {

```
"intelligence" : 7

```

}  
}

Now when i login into the Kibana with the user "developerUSER" i can get the access for the docs where "designation":"developer"

Now how i need to add the another condion("designation":"Tester") to the same role(A) for other specific user(testerUSER)

Please anone help me out

---

<div class="post-metadata">

**Author:** ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)\
**Post date:** [September 20, 2016, 4:06pm UTC](https://discuss.elastic.co/t/how-to-give-more-than-one-condition-based-to-user-for-the-specifc-role/61024/2 "2016-09-20T16:06:37Z")

</div>

> Now how i need to add the another condion("designation":"Tester") to the same role(A) for other specific user(testerUSER)

Roles cannot currently be conditional per user; so I think you should just create a different role for the testeruser.

---

<div class="post-metadata">

**Author:** ![balubollam](https://avatars.discourse-cdn.com/v4/letter/b/a587f6/32.png) [@balubollam](https://discuss.elastic.co/u/balubollam)\
**Post date:** [September 20, 2016, 4:22pm UTC](https://discuss.elastic.co/t/how-to-give-more-than-one-condition-based-to-user-for-the-specifc-role/61024/3 "2016-09-20T16:22:25Z")

</div>

Hi jayamode,

Thanx for Your quick response

Ya i too thought the same to add the another role.......but we have multiples designations so thinking for the alternative...........As of now i will do this ,Thank You

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:41pm UTC](https://discuss.elastic.co/t/how-to-give-more-than-one-condition-based-to-user-for-the-specifc-role/61024/4 "2017-07-06T13:41:48Z")

</div>


