# Multi-State Button - Per Button Security

**URL:** <https://forum.inductiveautomation.com/t/multi-state-button-per-button-security/20108>\
**Category:** Ignition\
**Created:** [October 11, 2018, 9:30pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-per-button-security/20108 "2018-10-11T21:30:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gopdahl](https://avatars.discourse-cdn.com/v4/letter/g/97f17d/32.png) [@gopdahl](https://forum.inductiveautomation.com/u/gopdahl)\
**Post date:** [October 11, 2018, 9:30pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-per-button-security/20108/1 "2018-10-11T21:30:40Z")

</div>

Is it possible to modify the properties of a multi-state button on a per-button basis? For example, say I have a Hand-Off-Auto selector with three levels of security depending on what user is logged in. I want “level 1” to be able to see the buttons but not select any, I want “level 2” to see all buttons but only be able to select Off or Auto, and I want “level 3” to be able to select any of the buttons. Is this possible?

---

<div class="post-metadata">

**Author:** ![DavidWisely](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/davidwisely/32/10482_2.png) [@DavidWisely](https://forum.inductiveautomation.com/u/DavidWisely)\
**Post date:** [October 13, 2018, 11:20am UTC](https://forum.inductiveautomation.com/t/multi-state-button-per-button-security/20108/2 "2018-10-13T11:20:03Z")

</div>

In this case it might be better to use separate buttons!

If you really want to use a multi-state button, I would create a custom property on the Multi-State Button called ControlValue2. Then add the code below to the Multi-State Button property change event. It will only update ControlValue2 if your user meets the roles requirements.

```auto
if event.propertyName == 'controlValue':
	userName = system.security.getUsername()
	user = system.user.getUser("", userName)
	userRoles = user.getRoles()
	
	if 'level 3' in userRoles:
		event.source.ControlValue2 = event.newValue
	elif 'level 2' in userRoles:
		if event.newValue != '2':
			event.source.ControlValue2 = event.newValue

```

Bind ControlValue2 to the Indicator Value to update the display of the Multi-State Button.  
Now, instead of using ControlValue, just use ControlValue 2 in your logic.

You could also bind the Enabled property to this expression

```auto
hasRole("level 2") || hasRole("level 3")

```

---

<div class="post-metadata">

**Author:** ![gopdahl](https://avatars.discourse-cdn.com/v4/letter/g/97f17d/32.png) [@gopdahl](https://forum.inductiveautomation.com/u/gopdahl)\
**Post date:** [October 15, 2018, 8:46pm UTC](https://forum.inductiveautomation.com/t/multi-state-button-per-button-security/20108/3 "2018-10-15T20:46:03Z")

</div>

Separate buttons it is! Thanks!
