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-03-10 17:50:07

mdyason
Member
Registered: 2015-01-20
Posts: 43

Putting a user into a group

I am trying to use the API to put a particular user into a particular group.  The first problem I have is getting the id for a single user.  Is there a way to do this if I have the users username.  I know I can get a list of all users with Users.getAllUsers but that does not contain userNames (just userDescriptions).

Is there actually an API method that will add a user to a particular group?  (I tried ApplyUserPreset using the name of a group, but that does not work).

The idea behind this is that we use LDAP and when a user logs in for the first time, we have no control of the group they will go into.  We would like to run a routine to move the users to whichever group they need to be in. 

Can this be done?

Offline

#2 2015-03-10 17:59:24

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

Re: Putting a user into a group

Yes, this can be done - the syntax is g:<group ID>; you can make a call to Users.GetAvailableUserPresets to get a list of available presets and groups (where the IDs are in the correct format).

Dominic

Offline

#3 2015-03-10 18:18:21

mdyason
Member
Registered: 2015-01-20
Posts: 43

Re: Putting a user into a group

Great!  That was a very quick reply.  Thank you. 
Works perfectly.

Is there another way to get the userID from a username for a single user?

Offline

#4 2015-03-19 18:12:10

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

Re: Putting a user into a group

There isn't a convenient way to get the user ID from a username, but in most cases you can pass the username itself in API requests.

Offline

Board footer