# How to access user security levels when calling a module python script calls from Designer?

**URL:** <https://forum.inductiveautomation.com/t/how-to-access-user-security-levels-when-calling-a-module-python-script-calls-from-designer/110128>\
**Category:** Module Development\
**Tags:** ignition81, perspective, scripting\
**Created:** [August 22, 2025, 8:29pm UTC](https://forum.inductiveautomation.com/t/how-to-access-user-security-levels-when-calling-a-module-python-script-calls-from-designer/110128 "2025-08-22T20:29:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyler\_Dolan](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@Tyler\_Dolan](https://forum.inductiveautomation.com/u/Tyler_Dolan)\
**Post date:** [August 22, 2025, 8:29pm UTC](https://forum.inductiveautomation.com/t/how-to-access-user-security-levels-when-calling-a-module-python-script-calls-from-designer/110128/1 "2025-08-22T20:29:21Z")

</div>

I am able to access user security levels in our module when calling a python script from Perspective.

However, when I call the same script function from the designer script console, `SecurityContext.THREAD_LOCAL.get()` returns a null value.

```java
var securityContext = SecurityContext.THREAD_LOCAL.get();
if(securityContext == null) { // securityContext is null when called from Designer
    logger.warn("No security context");
} else {
    var levels = securityContext.getSecurityLevels(); // good values when called from Perspective 
    var roles = securityContext.getRoles();
    var zones = securityContext.getSecurityZones();
}

```

I have also tried accessing user security levels with:

```java
var session = ClientReqSession.get();
var sessionUser = (ClientReqSession.User)session.getAttribute(ClientReqSession.SESSION_USER);
securityContext = SecurityContext.fromAuthenticatedUser(sessionUser.getUser().get());
var levels = securityContext.getSecurityLevels();

```

But in this case, the assigned security levels in the identity provider user grants screen aren't present in `securityContext.getSecurityLevels()`.

What is the proper way to access a user's security levels when the function is called from Designer?

---

<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:** [August 22, 2025, 9:14pm UTC](https://forum.inductiveautomation.com/t/how-to-access-user-security-levels-when-calling-a-module-python-script-calls-from-designer/110128/2 "2025-08-22T21:14:11Z")

</div>

```python
var session = ClientReqSession.get();
var sessionUser = (ClientReqSession.User)session.getAttribute(ClientReqSession.SESSION_USER);
var levels = sessionUser.getSecurityLevels();

```
