# Getting project name from system.perspective.login

**URL:** <https://forum.inductiveautomation.com/t/getting-project-name-from-system-perspective-login/90739>\
**Category:** Ignition\
**Tags:** perspective, scripting, ignition81\
**Created:** [May 22, 2024, 2:23pm UTC](https://forum.inductiveautomation.com/t/getting-project-name-from-system-perspective-login/90739 "2024-05-22T14:23:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Boyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew_boyers/32/59236_2.png) [@Matthew\_Boyers](https://forum.inductiveautomation.com/u/Matthew_Boyers)\
**Post date:** [May 22, 2024, 2:23pm UTC](https://forum.inductiveautomation.com/t/getting-project-name-from-system-perspective-login/90739/1 "2024-05-22T14:23:42Z")

</div>

We have our security configured to use an Identity Provider, and we have a custom module that contains a script that gets the roles from the SAML response. We call this script in the attribute mapping for "Roles" via the "RunScript" expression function. When this call is made, we pass the SAML response and the hostname as parameters. That function works.

What I am trying to do now is pass the project name as an additional parameter by calling our module script like this: runScript("system.idp.processIdpResponse(samlResponse, system.net.getHostName(),system.project.getProjectName())")

The issue I am running into is trying to use this with project inheritance, we have a "Master" project, and a inherited "Client" project. When I fire the command system.perspective.login() from the "Client" project, the system.project.getProjectName() returns back "Master" instead of "Client".

When system.perspective.login() occurs inside of the "Client" project, is there a way to determine which project that command came from? Is there a way to get that in the ClientHook of the module via the SDK?

---

<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:** [May 22, 2024, 2:26pm UTC](https://forum.inductiveautomation.com/t/getting-project-name-from-system-perspective-login/90739/2 "2024-05-22T14:26:12Z")

</div>

> [@Matthew\_Boyers](#):
>
> When I fire the command system.perspective.login() from the "Client" project, the system.project.getProjectName() returns back "Master" instead of "Client".

~~That sounds like a bug you should report to support.~~

Hmm. Maybe not. I'm not sure the IdP is project-scope. Are you sure you aren't just getting the gateway scripting project?

(Have you seen the note in the nightly changes that the complete XML response will be available in session vars soon? That would let you extract custom info in bindings instead of in the IdP.)

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [May 22, 2024, 2:31pm UTC](https://forum.inductiveautomation.com/t/getting-project-name-from-system-perspective-login/90739/3 "2024-05-22T14:31:48Z")

</div>

Or, potentially, [this](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-project/system-project-getProjectName) may be happening:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/5/55e8e0a9e6d8b357a7457da258ed3b792734173c.png)

---

<div class="post-metadata">

**Author:** ![Matthew\_Boyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matthew_boyers/32/59236_2.png) [@Matthew\_Boyers](https://forum.inductiveautomation.com/u/Matthew_Boyers)\
**Post date:** [May 22, 2024, 2:40pm UTC](https://forum.inductiveautomation.com/t/getting-project-name-from-system-perspective-login/90739/4 "2024-05-22T14:40:16Z")

</div>

The Gateway Scripting Project is configured for "Master". When calling system.perspective.login, what scope does that run under?

When you call the RunScript from the expression in the IDP mapping, what scope does that run under?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 22, 2024, 2:55pm UTC](https://forum.inductiveautomation.com/t/getting-project-name-from-system-perspective-login/90739/5 "2024-05-22T14:55:38Z")

</div>

Everything in perspective runs in Gateway Scope.

---

<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:** [May 22, 2024, 3:03pm UTC](https://forum.inductiveautomation.com/t/getting-project-name-from-system-perspective-login/90739/6 "2024-05-22T15:03:34Z")

</div>

> [@lrose](#):
>
> Gateway Scope.

Gateway scope has sub-scopes for projects, and anything outside projects falls back to the gateway scripting project. Identity providers are set up outside projects, so it is no surprise that anything executed within the IdP falls back to the gateway scripting project.
