Third Light Developer Exchange

Code and templating community forum for developers and software integrators

You are not logged in.

Announcement

If you wish to join the Developer Exchange, please contact your account manager - this is to avoid unnecessary spam in the forums. Many thanks for your understanding.

#1 2015-07-15 21:51:16

Ironykins
Member
Registered: 2015-06-22
Posts: 9

Getting user information from Username or Email Address

Hey devs,

We are trying to use the API to change the owners of several files. The call to change file ownership requires a user account ID, which we need to obtain.

Unfortunately the only method we can see get this info is Users_GetAllUsers, which returns a list of every user on the system. We can then filter down by username or email address.

This is hella inefficient, and kind of a pain to work with. I was wondering if there was a better way to grab the info. (Something along the lines of Users_GetUserIdFromEmail or Users_GetUserIdFromUsername, or even just a query for users.)

Cheers!

Offline

#2 2015-07-16 11:25:08

dominic
Third Light Staff
Registered: 2013-06-06
Posts: 96

Re: Getting user information from Username or Email Address

Hi,

I'm afraid that at present there isn't really a better way: when you call Core.ImpersonateUser you can supply user lookup details, and you could extract the user ID from the returned hash - however this probably isn't an improvement overall, since this involves creating and then disposing of a session each time. The response from Users.GetAllUsers should be fairly cacheable, and so the most pragmatic short-term route might be to use this.

I will have a look at exposing the user lookup via the API, we may be able to make that available as it does seem like a reasonable thing to want to do.

Dominic

Offline

#3 2015-07-16 16:57:42

dominic
Third Light Staff
Registered: 2013-06-06
Posts: 96

Re: Getting user information from Username or Email Address

Hi,

As of IMS v6.1.8-8, a new method Users.FindUser() is available, and allows you to look up the ID of a user based on their username or e-mail address (or, where relevant, their LDAP user principal or sAMAccountName).

Dominic

Offline

#4 2015-07-16 17:14:51

Ironykins
Member
Registered: 2015-06-22
Posts: 9

Re: Getting user information from Username or Email Address

Wow! I'm floored by how fast that was. Thank you!

Offline

Board footer