# Perspective Docked Window based on security

**URL:** <https://forum.inductiveautomation.com/t/perspective-docked-window-based-on-security/88837>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [April 15, 2024, 5:01pm UTC](https://forum.inductiveautomation.com/t/perspective-docked-window-based-on-security/88837 "2024-04-15T17:01:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfolkes](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@rfolkes](https://forum.inductiveautomation.com/u/rfolkes)\
**Post date:** [April 15, 2024, 5:01pm UTC](https://forum.inductiveautomation.com/t/perspective-docked-window-based-on-security/88837/1 "2024-04-15T17:01:05Z")

</div>

is there a good way to hide / prevent access to Docked windows based on security level / Role / of logged in user?

I have some admin windows that are docked with handle to expose them, but I only want those to be there if Role = "admin"

---

<div class="post-metadata">

**Author:** ![Nick\_Wilson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nick_wilson/32/80663_2.png) [@Nick\_Wilson](https://forum.inductiveautomation.com/u/Nick_Wilson)\
**Post date:** [April 15, 2024, 5:12pm UTC](https://forum.inductiveautomation.com/t/perspective-docked-window-based-on-security/88837/2 "2024-04-15T17:12:01Z")

</div>

I would do the following:

1. Set the dock to be hidden by default in the page configuration
2. Create your own dock handle and add a property binding on its "display" / "enabled" properties. Bind it to self.session.props.auth.user.roles.
3. Add a script transform on this binding. Something to the effect of this:

```auto
if "admin" in self.session.props.auth.user.roles:
	return True
return False

```

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [April 15, 2024, 5:17pm UTC](https://forum.inductiveautomation.com/t/perspective-docked-window-based-on-security/88837/3 "2024-04-15T17:17:25Z")

</div>

There is no way to configure the presence of Docked Views via Security Levels or Roles, but you can absolutely place those security restrictions on the View itself so that the View doesn't render unless the User has the required permissions.

I suppose one approximation of this behavior would be to have all Docked Views collapsed by default, and each Docked View would have a custom property bound to an expression which makes the check against permissions. in a change script for the property, you could then invoke `system.perspective.openDock(...)`.

> [@Nick\_Wilson](#):
>
> Create your own dock handle

Custom UI to expand/collapse Docked Views is great and allows for the best custom handling, but it also means you need to position that UI across all Views which would be used as Primary Views.

> [@Nick\_Wilson](#):
>
> ```python
> if "admin" in self.session.props.auth.user.roles:
> return True
> return False
> 
> ```

Could be cleaned up:

```python
# Anytime you find yourself with an if/else -> True/False
# bit of logic, ask yourself if there's a cleaner way to implement.
return "admin" in self.session.props.auth.user.roles

```
