gitlab-bash-api icon indicating copy to clipboard operation
gitlab-bash-api copied to clipboard

Additional functionality

Open johnbritto1 opened this issue 7 years ago • 1 comments

Hello,

The pain part is when we have to add a new user to 30+ group. At present, there is no single solution from Gitlab on achieving this without 30+ clicks in GUI. Could you add a functionality to add a user to N number of groups ID's and Project ID's.

Thanks,

johnbritto1 avatar Oct 29 '18 06:10 johnbritto1

You can use:

./glCreateUser.sh USER_NAME 'USER_FULLNAME' 'USER_EMAIL'

Let say, you have a JSON like this:

[
  { "name": "name1", "email": "[email protected]" },
  { "name": "name2", "email": "[email protected]" }
]

Then just adapt create a script like this:

echo '[{"name":"name1","email":"[email protected]"},{"name":"name2","email":"[email protected]"}]' | 
  jq -c .[] | 
  while read -r entry ; do 
    name="$( jq .name <<<"${entry}" ) "
    email="$( jq .email <<<"${entry}" )" 
    echo "Add '${name}' '${email}'"
    # ./glCreateUser.sh "${name}" "${name}" "${email}"
done

cClaude avatar Nov 20 '21 12:11 cClaude