# hasRole with multiple roles

**URL:** <https://forum.inductiveautomation.com/t/hasrole-with-multiple-roles/110150>\
**Category:** Ignition\
**Created:** [August 25, 2025, 5:08pm UTC](https://forum.inductiveautomation.com/t/hasrole-with-multiple-roles/110150 "2025-08-25T17:08:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![carter.doud](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@carter.doud](https://forum.inductiveautomation.com/u/carter.doud)\
**Post date:** [August 25, 2025, 5:08pm UTC](https://forum.inductiveautomation.com/t/hasrole-with-multiple-roles/110150/1 "2025-08-25T17:08:48Z")

</div>

is there any way to use hasRole with multiple roles, I would like to allow visibility on a button for multiple roles, but I get errors for most of the ways I have tried to do it.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 25, 2025, 5:11pm UTC](https://forum.inductiveautomation.com/t/hasrole-with-multiple-roles/110150/2 "2025-08-25T17:11:50Z")

</div>

use the logical OR in the expression `||` (double pipe)

```python

hasRole(x) || hasRole (y)

```

---

<div class="post-metadata">

**Author:** ![rbabcock](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rbabcock/32/13425_2.png) [@rbabcock](https://forum.inductiveautomation.com/u/rbabcock)\
**Post date:** [August 25, 2025, 5:12pm UTC](https://forum.inductiveautomation.com/t/hasrole-with-multiple-roles/110150/3 "2025-08-25T17:12:00Z")

</div>

`hasRole("Role1", "bob", "default") || hasRole("Role2", "bob", "default")`

---

<div class="post-metadata">

**Author:** ![carter.doud](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@carter.doud](https://forum.inductiveautomation.com/u/carter.doud)\
**Post date:** [August 25, 2025, 5:13pm UTC](https://forum.inductiveautomation.com/t/hasrole-with-multiple-roles/110150/4 "2025-08-25T17:13:48Z")

</div>

Wow, fast responses, thank you!
