# Notes from user gateway

**URL:** <https://forum.inductiveautomation.com/t/notes-from-user-gateway/99114>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [November 26, 2024, 12:48pm UTC](https://forum.inductiveautomation.com/t/notes-from-user-gateway/99114 "2024-11-26T12:48:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [November 26, 2024, 12:48pm UTC](https://forum.inductiveautomation.com/t/notes-from-user-gateway/99114/1 "2024-11-26T12:48:57Z")

</div>

Hello!

In order to aply some filters on my project depending on the user logging in I would need to add some notes on each user.

To get the userName Perspective use: session.props.auth.user.userName

how to fetch the notes from User Properties?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/f/1f740c94c918d96aed496b6bbc23998c373ced13.png)

---

<div class="post-metadata">

**Author:** ![deon.korb](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@deon.korb](https://forum.inductiveautomation.com/u/deon.korb)\
**Post date:** [November 26, 2024, 1:01pm UTC](https://forum.inductiveautomation.com/t/notes-from-user-gateway/99114/2 "2024-11-26T13:01:08Z")

</div>

Use the user name to call `system.user.getUser(userSource, username)`

> **[system.user.getUser | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-user/system-user-getUser)**
>
> Looks up a specific user in a user source, by username.

You should get the notes from the return user object.

> **[Scripting Object Reference | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/reference-pages/scripting-object-reference#users)**
>
> This page describes several common scripting objects

---

<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:** [November 26, 2024, 1:19pm UTC](https://forum.inductiveautomation.com/t/notes-from-user-gateway/99114/3 "2024-11-26T13:19:23Z")

</div>

`system.user.getUser()` only works with Ignition User Sources, not Identity Providers. While you can use Ignition's native Identity Provider to work through a user source, external identity providers are popular.

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [November 26, 2024, 1:39pm UTC](https://forum.inductiveautomation.com/t/notes-from-user-gateway/99114/4 "2024-11-26T13:39:06Z")

</div>

Hi,

in Ignition Vision we had access to Notes with:

```python
import re
import app.misc

app.misc.userName = system.security.getUsername()

oUser = system.user.getUser(app.misc.strUserSource, app.misc.userName)
app.misc.userRoles = oUser.getRoles()

try:
	cNotes = oUser.getOrDefault(oUser.Notes)
	if (cNotes == "") or (cNotes == None):
		cNotes = "level:0;groups:0;zones:8;mainGroup:-1"
except:
	cNotes = "level:0;groups:0;zones:8"

if ('Administrador' in app.misc.userRoles) or ('Direccion' in app.misc.userRoles):
	cNotes = "access:9999999999;zones:0,1,2,3,4,5,6"
	

```

In ignition perspective can have access to notes??? with:

```python
	from com.inductiveautomation.ignition.common import BasicDataset
	

	userSource = "default"
	userName = session.props.auth.user.userName
	
	try:
	    if userName:
	
	        user = system.user.getUser(userSource, userName)
	
	        if user is not None:
	          
	            notes = user.get("notes")
	            if notes is None:
	                notes = "No notes available for this user."
	        else:
	            notes = "User not found."
	
	     
	        session.custom.userNotes = notes
	    else:
	        session.custom.userNotes = "User not logged in."

```

or should I try using ?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/7/77c03e23303266191b08a04313bfd3f77bb43ef9.png)

---

<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:** [November 26, 2024, 1:43pm UTC](https://forum.inductiveautomation.com/t/notes-from-user-gateway/99114/5 "2024-11-26T13:43:52Z")

</div>

If you are using Ignition's internal IdP, you can use `system.user.getUser()`. If using any other IdP, you must work with the data the IdP supplied. In recent versions of Ignition the complete data packet is supplied to a session property, but you will probably want to use attribute mapping:

> **[User Attribute Mapping | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/platform/security/identity-provider-authentication-strategy/configuring-identity-providers/user-attribute-mapping)**
>
> The User Attribute Mapping page allows you to map information in the Identity Providers (IdP) response document to easily understandable properties. These properties are then made available as Session Properties in the Perspective Session. To work,...

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [November 26, 2024, 1:50pm UTC](https://forum.inductiveautomation.com/t/notes-from-user-gateway/99114/6 "2024-11-26T13:50:43Z")

</div>

Right now I using Ignition Idp. But for some reason I don´t reach notes with my fetch:

```python
from com.inductiveautomation.ignition.common import BasicDataset
	

	userSource = "default"
	userName = session.props.auth.user.userName
	
	try:
	    if userName:
	
	        user = system.user.getUser(userSource, userName)
	
	        if user is not None:
	          
	            notes = user.get("notes")
	            if notes is None:
	                notes = "No notes available for this user."
	        else:
	            notes = "User not found."
	
	     
	        session.custom.userNotes = notes
	    else:
	        session.custom.userNotes = "User not logged in."

```

---

<div class="post-metadata">

**Author:** ![Alejandro\_Alaco](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alejandro_alaco/32/59849_2.png) [@Alejandro\_Alaco](https://forum.inductiveautomation.com/u/Alejandro_Alaco)\
**Post date:** [November 26, 2024, 3:08pm UTC](https://forum.inductiveautomation.com/t/notes-from-user-gateway/99114/7 "2024-11-26T15:08:14Z")

</div>

Ok, now working after restart the gateway, thank you!

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/d/7dbe943bf49fe6fe37922c38efddc861fade6270.png)
