# \[IGN-3333\]Set a user as read-only when starting Perspective client

**URL:** <https://forum.inductiveautomation.com/t/ign-3333-set-a-user-as-read-only-when-starting-perspective-client/63896>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [September 8, 2022, 6:52pm UTC](https://forum.inductiveautomation.com/t/ign-3333-set-a-user-as-read-only-when-starting-perspective-client/63896 "2022-09-08T18:52:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_M](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@Daniel\_M](https://forum.inductiveautomation.com/u/Daniel_M)\
**Post date:** [September 8, 2022, 6:52pm UTC](https://forum.inductiveautomation.com/t/ign-3333-set-a-user-as-read-only-when-starting-perspective-client/63896/1 "2022-09-08T18:52:31Z")

</div>

I’m trying to set up a script to set a certain type of user as read-only when they start up their perspective client using Session Events\>startup in version 8.1. I’m partially going off of the trainings on Inductive University:

```auto
if u'Administrator'in system.security.getRoles():
    #This part of the script will run if the user has the correct priviliges. For example:"
    print "this script will run if the user has a the administrator role."
else:
    system.gui.errorBox('Insufficient security privileges.')

```

The code I have so far:

```auto
if (u'Administrator' or u'Operator') in system.security.getRoles():
    system.util.setConnectionMode(3)
elif u'Visitor' in system.security.getRoles():
    system.util.setConnectionMode(2)
else
    system.util.setConnectionMode(1)

```

As the code states, I want administrators and operators to have full read-write access in the client, visitors will have read-only, and anyone else will disconnect.

For some reason though, this code isn’t working. I’m not sure why though.

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [September 8, 2022, 7:03pm UTC](https://forum.inductiveautomation.com/t/ign-3333-set-a-user-as-read-only-when-starting-perspective-client/63896/2 "2022-09-08T19:03:18Z")

</div>

`system.util.setConnectionMode()` only applies to vision clients

For perspective I believe you’d use [system.perspective.isAuthorized - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.perspective.isAuthorized)  
to logout users who aren’t administrators / operators / visitors

In conjunction with component level security settings to only allow administrators / operators write access for buttons/ etc. [Security in Perspective - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Security+in+Perspective)

I don’t believe there’s a global setting for it like there is for vision, but I might be wrong.

---

<div class="post-metadata">

**Author:** ![Daniel\_M](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@Daniel\_M](https://forum.inductiveautomation.com/u/Daniel_M)\
**Post date:** [September 8, 2022, 7:28pm UTC](https://forum.inductiveautomation.com/t/ign-3333-set-a-user-as-read-only-when-starting-perspective-client/63896/3 "2022-09-08T19:28:10Z")

</div>

I hope there is a way to do it globally in Perspective. It’s on an existing project and with the amount of controls there are, it would be significant. Thanks for your response.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 8, 2022, 7:33pm UTC](https://forum.inductiveautomation.com/t/ign-3333-set-a-user-as-read-only-when-starting-perspective-client/63896/4 "2022-09-08T19:33:24Z")

</div>

> [@Daniel\_M](#):
>
> `(u'Administrator' or u'Operator') in system.security.getRoles()`

Python/Jython doesn't allow you to put multiple items in the first part of the `in` operator. It isn't a syntax error, but it won't find a boolean `True` anywhere in the list.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 8, 2022, 7:39pm UTC](https://forum.inductiveautomation.com/t/ign-3333-set-a-user-as-read-only-when-starting-perspective-client/63896/5 "2022-09-08T19:39:10Z")

</div>

Perspective does not have an analogue for the ‘connection mode’ setting Vision has. The most global way to configure things is with either tag security, or restricting access to views that have the ability to write to tags.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 8, 2022, 7:47pm UTC](https://forum.inductiveautomation.com/t/ign-3333-set-a-user-as-read-only-when-starting-perspective-client/63896/6 "2022-09-08T19:47:56Z")

</div>

> [@paul-griffith](#):
>
> or restricting access to views that have the ability to write to tags.

How exactly would that work?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 8, 2022, 7:56pm UTC](https://forum.inductiveautomation.com/t/ign-3333-set-a-user-as-read-only-when-starting-perspective-client/63896/7 "2022-09-08T19:56:27Z")

</div>

View permissions:  
[https://docs.inductiveautomation.com/display/DOC81/Security+in+Perspective#SecurityinPerspective-PerspectiveViewsSecurity](https://docs.inductiveautomation.com/display/DOC81/Security+in+Perspective#SecurityinPerspective-PerspectiveViewsSecurity)

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [September 8, 2022, 8:41pm UTC](https://forum.inductiveautomation.com/t/ign-3333-set-a-user-as-read-only-when-starting-perspective-client/63896/8 "2022-09-08T20:41:48Z")

</div>

Oh right, I guess I read too much into your comment 🙂  
I was aware of view permissions
