Changing all users project limit to "0"

Hello!

I`ve been using Gitlab CE for a few months and i need to change all users project creation limit to “0”. I know that i can change this on their settings, but there are a lot of users, is there a way that i can apply a script that do this for me? If so, how do i apply it? is there any API that i have to use or how do i excecute it?

Can use Gitlab API to do this.

https://scm.hue.workslan/help/api/users.md

Didn’t test this but something like below
To get a list of users:
https://scm.hue.workslan/api/v4/users

To update projects limits:
curl -H ‘Content-Type:application/json’ -H ‘Accept:application/json’ -X PUT -d ‘{“projects_limit”:0}’ http:///api/v4/users/?private_token=

==
#!/bin/bash

declare -a USER_IDS=$(curl --insecure -H “PRIVATE-TOKEN: b_BQVCqbRFX233W7sUju” -H ‘Accept:application/json’ -X GET https://scm.hue.workslan/api/v4/users?per_page=10 | jq ‘. | .id’)

for user_id in "{USER_IDS[@]}"; do curl -H 'Content-Type:application/json' -H 'Accept:application/json' -X PUT -d '{"projects_limit":0}' http://<gitlab address>/api/v4/users/{user_id}?per_page=500&private_token=
done

1 Like

Thank you so much Hozawa! This was very useful and it help my purposes. I appreciate that you took the time to help me.