# Security projet with on perspective

**URL:** <https://forum.inductiveautomation.com/t/security-projet-with-on-perspective/58500>\
**Category:** Ignition\
**Created:** [April 15, 2022, 11:27am UTC](https://forum.inductiveautomation.com/t/security-projet-with-on-perspective/58500 "2022-04-15T11:27:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebastien\_ng](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sebastien_ng/32/55297_2.png) [@sebastien\_ng](https://forum.inductiveautomation.com/u/sebastien_ng)\
**Post date:** [April 15, 2022, 11:27am UTC](https://forum.inductiveautomation.com/t/security-projet-with-on-perspective/58500/1 "2022-04-15T11:27:01Z")

</div>

Hello, I want translate this script on my perspective projet.  
Somme one can help me?

def onStartup(session):  
“”"  
Called when a new session is authorized and starts.

```
Arguments:
	session: A reference to the newly created session
"""
username = system.security.getUsername()
if "admin" == username.lower():
   # Set "guest" user to read-only mode.
   system.util.setConnectionMode(2)
else:
   system.util.setConnectionMode(3)
```

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [April 15, 2022, 11:42am UTC](https://forum.inductiveautomation.com/t/security-projet-with-on-perspective/58500/2 "2022-04-15T11:42:10Z")

</div>

if this is a copy of you vision, than your vision is not that correct either, you should not validate to usernames, but to userRoles.

in perspective you can get the userRoles (and name i suppose but dont use it) in the session props

```auto
self.session.props.auth.user.roles
self.session.props.auth.user.userName

```

system.util.setConnectionMode() also doesnt exsits in perspective tho.  
no idea if there is something that does something similar in perspective
