Add new users

We are using NT Authentication scheme in our teamcity 5.x enterprise implementation. We have set up the All Users group without any role in that, thereby disallowing user's to see any project on their first login. Now, if users need access to any of the projects configuered, they have to raise a request to the System Administrator to give them access to specific projects. We actually don't want to make it a 2 step process. What we want is that System Admin somehow setup the users in teamcity and when they ask for an access, we should provide them the required role and they get their account setup with required role on their first login. It should not be mandatory for user to login atleast once, so that his account is created in teamcity.

Could anyone please suggest some way to add users or some other approach.

1
15 comments
Avatar
Permanently deleted user

Hello,

For NT authentication user is created only on user login. So you can't assign any roles to a user who hasn't login yet.
What you can do is create a group(s) with all required roles. Granting permissions to a user will then require just assignment to the particular group. This operation can be done for multiple users at once.
As an alternative you can write ad-hoc TeamCity plugin for this.


---
Maxim

0
Avatar
Permanently deleted user

Thanks Maxim,

As an alternative, I tried adding the user with user group assigned to USERS and USERGROUP_USERS tables in teamcity database. When that user logged in for the very first time, his roles and user goup were defined perfectly fine. But when I logged in as an system admin, I could not see his user account in the teamcity UI users and groups section. I could only see his profile on UI, after I restarted the teamcity web server.  Is this approach is OK to use or it might have some adverse effects on other operations. Please suggest.

0
Avatar
Permanently deleted user

Hi,

Manual database modification is dangerous, because most commonly it leaves the system in inconsistent state. I can't say right now what other tables must be updated.
Please don't do this unless it is absolutely necessary.
A more convenient approach is to use TeamCity open api (in plugin), using which you can create/edit users, assign roles etc.


---
Maxim

0
Avatar
Permanently deleted user

Thanks Maxim,

I have no idea about teamcity open API, could you please guide me through any URL, tutorial on using open api through which I can create/edit users, roles etc.

0
Avatar
Permanently deleted user

Please our documentation:
http://confluence.jetbrains.net/display/TCD5/Developing+TeamCity+Plugins

From the open-api you'll need jetbrains.buildServer.users.UserModel and jetbrains.buildServer.groups.SUserGroup files.


---
Maxim

0
Avatar
Permanently deleted user

Looking at the documentations, I am not able to figure out, how to implement these interfaces UserModel or SUserGroup.

0
Avatar
Permanently deleted user

You don't need to implement them. You can use them to create users and add them to groups.

0
Avatar
Permanently deleted user

Can you explain how one would get a list of all groups, or find an individual group by name?  I see there is a UserGroupManager class in the server.jar, but can't find a clear way to achieve this using the OpenAPI.

0
Avatar
Permanently deleted user

Mike,

UserGroupManager interface (from open-api) provides several methods. Among them:
getUserGroups()
findUserGroupByName()

---
Maxim

0
Avatar
Permanently deleted user

I'm aware of UserGroupManager - but the point I'm trying to make is that it doesn't seem to be part of the Open API:

http://javadoc.jetbrains.net/teamcity/openapi/current/

Am I missing something?

0
Avatar
Permanently deleted user

Mike,

Sorry, I thought this class is included in open-api. Apparently it is not.
I think the simplest way to find a group using open-api only is through SUser.getAllUserGroups() method (pick the user first).


---
Maxim

0
Avatar
Permanently deleted user

Would there be an issue just coding against server.jar and using the UserGroupManager?

0
Avatar
Permanently deleted user

Mike,

Usually it would, because the internal interfaces can change from one version to another. But I don't think it will happen to UserGroupManager. Probably we'll even move it to open-api.
You just need to get the plugin compile and run.

0
Avatar
Permanently deleted user

That's where I am stuck. In getting the plugin to compile and run. Mike, have you been able to do so?

0
Avatar
Permanently deleted user
0

Please sign in to leave a comment.