File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -u
3
+
4
+ SCRIPT_DIR=$( builtin cd " $( dirname ${BASH_SOURCE[0]} ) " && builtin pwd)
5
+
6
+ source " ${SCRIPT_DIR} /common.sh"
7
+
8
+ __usage="
9
+ Usage: $( basename $0 ) USER TYPE
10
+
11
+ Arguments:
12
+ USER The account in $DOMAIN (sans domain) to assign
13
+ CLIENT The client code used to construct the group
14
+ "
15
+
16
+ # print usage for -? or -h or --help
17
+ if [[ " $# " -lt 2 || " $1 " =~ ^(-\? | -h| --help)$ ]]; then
18
+ echo " $__usage "
19
+ exit 0
20
+ fi
21
+
22
+ # the full account name to assign
23
+ ACCOUNT=" $1 @$DOMAIN "
24
+ # the full group name to assign
25
+ GROUP=" $2 @$DOMAIN "
26
+
27
+ # verify $ACCOUNT exists before continuing
28
+ if ! user_exists $ACCOUNT ; then
29
+ echo_ts " Account $ACCOUNT does not exist, stopping"
30
+ exit 1
31
+ else
32
+ echo_ts " Account $ACCOUNT exists, continuing..."
33
+ fi
34
+
35
+ # add to client group
36
+ gam user $ACCOUNT add groups member $GROUP
37
+
38
+ echo_ts " Account updated"
You can’t perform that action at this time.
0 commit comments