A
A
Andrey Strelkov2018-12-07 16:23:55
Python
Andrey Strelkov, 2018-12-07 16:23:55

How to sync GitLab users with Active Directory?

Good afternoon, I have a Gitlab Community Edition installed on my server
The server is located on the Intranet network where there is also an Active Directory
The task is such that the Active Directory has a special group gitlab-users, the essence of which is
that it contains users who must have gitlab.
On the gitlab side, the AD setting is done, made in such a way that the user can try to log in, but the git will create his account but will not activate it, telling the user that I kind of created it, but the admin must
confirm it turns out there should be some script that will do the following:
1. Get a list of AD users who are in the gitlab-users group
2. Cycle through this list, and through objectsid make a request via the gitlab API for the fact that such a user is already in the git (it turns out in advance in the user settings you need to add the so-called custom provider, or whatever they are called, but the essence of which is that it’s simple an additional field for the user, in which you just need to place objectsid)
3. If there is such a user, then compare the main fields (login, mailbox, name, etc.) and if one of them is different, then update also through the API gita. Or do not even check, but indiscriminately - found one - update
4. If you did not find it - then through the git API - create
And run such a script about once an hour on the crown.
The question is, is it possible to implement this in bash, or, as I was advised, should I already resort to python.
I don’t know either, so I ask where it’s better, where it’s easier and faster

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alfss, 2018-12-21
@alfss

You can also do it in bash by accessing the database directly.
You can use any programming language you like.
Or, for example, use cli https://github.com/NARKOZ/gitlab/blob/master/README.md

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question