Editing Vault users through API

Post your questions regarding using the Vault and Fortress API in your programs.

Moderator: SourceGear

Post Reply
Balthazor
Posts: 81
Joined: Fri Mar 11, 2005 4:10 pm
Location: Hartford, Wisconsin

Editing Vault users through API

Post by Balthazor » Mon Jul 28, 2014 3:45 pm

Hi, we need to update all our Vault user names and I'd like to write a quick utility to do this rather than having to manually change all the user names in the Vault Admin tool. I've got it to where it will change the user login, but the login will not work until I go into the Admin tool, open the new user and save it from there.

The code I've got which performs the update looks like this (vU is a VaultUser object):

vU.Login = NewLoginName;
bReturn = this.client.Connection.EditUser(vU);

Just wondering what else it is I need to do to make this work. Thanks!

jclausius
Posts: 3706
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: Editing Vault users through API

Post by jclausius » Tue Jul 29, 2014 8:13 am

How are you managing the Login process? Are you using the VaultClientIntegration wrappers?

The reason I ask, is I don't know how that will work. The Edit User API is found in the Admin Web Services. To get there through the API, the Client Instance needs to be initialized with AccessLevelType.Admin.

I think there is a Login() command which lets you specify Admin Access level, make sure to use AccessLevelType.Admin.
Jeff Clausius
SourceGear

Balthazor
Posts: 81
Joined: Fri Mar 11, 2005 4:10 pm
Location: Hartford, Wisconsin

Re: Editing Vault users through API

Post by Balthazor » Tue Jul 29, 2014 4:07 pm

Well I got it to mostly work. Yeah I am logging in with the AccessLevelType.Admin to access the user list, what I needed to do was to update the password along with the login name. All I can seem to do is null the password since the API doesn't seem to want to retrieve the existing password from the system, but that's ok for our purposes since none of our users besides the Admin user has a password anyhow.

jclausius
Posts: 3706
Joined: Tue Dec 16, 2003 1:17 pm
Location: SourceGear
Contact:

Re: Editing Vault users through API

Post by jclausius » Wed Jul 30, 2014 7:55 am

Glad you got it working.

BTW, if you set the VaultUser's Password member to null, it should remain unchanged through the call to EditUser().
Jeff Clausius
SourceGear

Post Reply