Changing repository access for a user that already has acces
Moderator: SourceGear
Changing repository access for a user that already has acces
I have given access to a repository for a user using:
AddRepositoryAccess
However, when I try to remove this user's access rights by passing:
VaultRepositoryAccess.None
to the AddRepositoryAccess function, I get a null exception thrown. If the user has not been given access before, no exception is thrown. Is there another way to change a user's access priveleges to a repository once he/she has already been given access?
Ben
AddRepositoryAccess
However, when I try to remove this user's access rights by passing:
VaultRepositoryAccess.None
to the AddRepositoryAccess function, I get a null exception thrown. If the user has not been given access before, no exception is thrown. Is there another way to change a user's access priveleges to a repository once he/she has already been given access?
Ben
Re: Changing repository access for a user that already has acces
Try using EditUser (also in VaultConnection). Get the VaultUser object - you can use VaultConnection.GetUserList - and modify the AccessInfo field, then pass that to EditUser.
Re: Changing repository access for a user that already has acces
I'll give that a try. Thanks.
Re: Changing repository access for a user that already has acces
The VaultUser that I'm interested in that is returned from GetUserList is only semi-populated, e.g. VaultAccessInfo is null. When I populate the VaultAccessInfo field and send it to EditUser, I get another null reference exception. Shouldn't VaultUser be completely populated when retrieving it using GetUserList?
Re: Changing repository access for a user that already has acces
Sorry, missed this method on my first search. Use VaultConnection.RemoveRepositoryAccess
Re: Changing repository access for a user that already has acces
That makes a lot more sense. Thank you.
I tried the method, but I'm getting a null reference exception. I'm connected to the database as an administrator, I can retrieve the repository id and user id and then I call RemoveRepositoryAccess with those parameters but get the null reference:
System.NullReferenceException : Object reference not set to an instance of an object.
Any thoughts on this one?
Ben
I tried the method, but I'm getting a null reference exception. I'm connected to the database as an administrator, I can retrieve the repository id and user id and then I call RemoveRepositoryAccess with those parameters but get the null reference:
System.NullReferenceException : Object reference not set to an instance of an object.
Any thoughts on this one?
Ben
Re: Changing repository access for a user that already has acces
Do you only get an exception with this one user? Is there anything in the server log? (%WINDIR%\Temp\sgvault\sgvault.log on the server machine) Or the client log? (%TEMP%/VaultGUIClient on the client machine)
Re: Changing repository access for a user that already has acces
Finally getting back to this. I'll check those things, thanks...
Re: Changing repository access for a user that already has acces
There is nothing unusual in the server log file. I could not locate the client log file. I have a user called "testuser1" that I AddRepositoryAccess'd to one of my repositories. That works fine. Then when I use the RemoveRepositoryAccess function I get the null reference exception. The program connects as admin to perform these functions. I haven't tried removing access of another user. Has anyone used this api call successfully?
Ben
Ben
Re: Changing repository access for a user that already has acces
We make several calls to it in our smoke tests. Can you show me the code you're working with?