# system.user.getUser() Case Sensitive

**URL:** <https://forum.inductiveautomation.com/t/system-user-getuser-case-sensitive/16895>\
**Category:** Ignition\
**Created:** [February 6, 2018, 8:29pm UTC](https://forum.inductiveautomation.com/t/system-user-getuser-case-sensitive/16895 "2018-02-06T20:29:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryanjmclaughlin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryanjmclaughlin/32/4318_2.png) [@ryanjmclaughlin](https://forum.inductiveautomation.com/u/ryanjmclaughlin)\
**Post date:** [February 6, 2018, 8:29pm UTC](https://forum.inductiveautomation.com/t/system-user-getuser-case-sensitive/16895/1 "2018-02-06T20:29:06Z")

</div>

Ran my self around in circles for a hour because I could not find a user with _system.user.getUser()_ although it most certainly existed in my user source!

Long story short it appears that this function is case-sensitive for the user name. Is there any workarounds to get around this? Unfortunately for this specific user source, I have no control over the case of the username.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [February 6, 2018, 9:08pm UTC](https://forum.inductiveautomation.com/t/system-user-getuser-case-sensitive/16895/2 "2018-02-06T21:08:58Z")

</div>

I think you’ll need to iterate over the userList. Here’s an example with two users with varying username capitalization:

```auto
def matchUser(userIn):
  # get all users
  users = system.user.getUsers('')
  
  foundFlag = 0
  
  # compare each user by lowercase
  for user in users:
    username = user.get(user.Username)
    if username.lower() == userIn.lower():
      foundFlag = 1
      break

  if foundFlag == 1:
    return system.user.getUser('',username)
  else:
    return 'User not found.'

    
user2find = 'JoRdAnC'
print matchUser(user2find)

user2find = 'gailw'
print matchUser(user2find)

```

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/223480289bb3f7c8252c2ea2d57d95c06f06a74d.png)

---

<div class="post-metadata">

**Author:** ![ryanjmclaughlin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryanjmclaughlin/32/4318_2.png) [@ryanjmclaughlin](https://forum.inductiveautomation.com/u/ryanjmclaughlin)\
**Post date:** [February 7, 2018, 3:13am UTC](https://forum.inductiveautomation.com/t/system-user-getuser-case-sensitive/16895/3 "2018-02-07T03:13:58Z")

</div>

I was afraid that was the answer. I have 5K+ users in some sources, so trying to avoid the iteration if possible, but this will certainly work. Thanks.

---

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [February 7, 2018, 5:49pm UTC](https://forum.inductiveautomation.com/t/system-user-getuser-case-sensitive/16895/4 "2018-02-07T17:49:07Z")

</div>

Could tidy it up a bit with a list comprehension:

```auto
users = system.user.getUsers('')
usernames = [u.get('username').lower() for u in users]
user2find ='myuser'
if user2find in usernames:
	return True # or do something else

```

---

<div class="post-metadata">

**Author:** ![bfuson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bfuson/32/4597_2.png) [@bfuson](https://forum.inductiveautomation.com/u/bfuson)\
**Post date:** [February 7, 2018, 6:03pm UTC](https://forum.inductiveautomation.com/t/system-user-getuser-case-sensitive/16895/5 "2018-02-07T18:03:08Z")

</div>

Returns user using a dictionary lookup:

```auto
def getUserIgnoreCase(user2find):
	users = system.user.getUsers('')
	usernames = [u.get('username').lower() for u in users]
	usersdict = dict(zip(usernames, users))
	if user2find.lower() in usersdict:
		return usersdict[user2find.lower()]
	else:
		return False

```

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [February 14, 2019, 3:42pm UTC](https://forum.inductiveautomation.com/t/system-user-getuser-case-sensitive/16895/6 "2019-02-14T15:42:00Z")

</div>

Just checking in on this. Seems like this is a bug on the Ignition side since a user can login without having to match case. Are there plans to make this not case sensitive?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 14, 2019, 3:58pm UTC](https://forum.inductiveautomation.com/t/system-user-getuser-case-sensitive/16895/7 "2019-02-14T15:58:24Z")

</div>

I think case sensitivity must be maintained because whether or not that matters is a detail of the underlying UserSourceProfile. The internal one, for example, prevents you from creating duplicate users in a case insensitive manner, but that is only enforced in the UI.

That some profiles will authenticate a user in a case insensitive manner is also a detail of that type of profile.

---

<div class="post-metadata">

**Author:** ![tobiasatats](https://avatars.discourse-cdn.com/v4/letter/t/ce7236/32.png) [@tobiasatats](https://forum.inductiveautomation.com/u/tobiasatats)\
**Post date:** [December 14, 2021, 10:36am UTC](https://forum.inductiveautomation.com/t/system-user-getuser-case-sensitive/16895/8 "2021-12-14T10:36:26Z")

</div>

But why is the gateway page and all launchers and even the login page for clients ignoring case sensitivity then?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 14, 2021, 1:31pm UTC](https://forum.inductiveautomation.com/t/system-user-getuser-case-sensitive/16895/9 "2021-12-14T13:31:54Z")

</div>

None of these things ignore case sensitivity - they pass the credentials _as provided_ to the underlying user source implementation, which may choose to ignore case sensitivity.

---

<div class="post-metadata">

**Author:** ![tobiasatats](https://avatars.discourse-cdn.com/v4/letter/t/ce7236/32.png) [@tobiasatats](https://forum.inductiveautomation.com/u/tobiasatats)\
**Post date:** [December 14, 2021, 2:26pm UTC](https://forum.inductiveautomation.com/t/system-user-getuser-case-sensitive/16895/10 "2021-12-14T14:26:45Z")

</div>

ah okay. it would be nice, if the getUser() could do that as well : )

is there a way to fetch that information from the user source?
