-
Notifications
You must be signed in to change notification settings - Fork 1
/
Ximp.sh
20 lines (19 loc) · 879 Bytes
/
Ximp.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
for PROJECT in $(gcloud projects list --format="value(projectId)")
do
echo "Project: ${PROJECT}"
echo $(gcloud projects get-iam-policy ${PROJECT} --format="json" > ${PROJECT}.json.orig)
cat ${PROJECT}.json.orig | sed -i 's/gmail.com/gmail.com/g' ${PROJECT}.json.orig > ${PROJECT}.json.new
gcloud projects set-iam-policy $PROJECT ${PROJECT}.json.new
rm -f ${PROJECT}.json.*
done
done
for ORG in $(gcloud organizations list --format="value(projectId)")
do
echo "Organisation: ${ORG}"
echo $(gcloud organizations get-iam-policy ${ORG} --format="json" > ${ORG}.json.orig)
cat ${ORG}.json.orig | sed -i 's/gmail.com/gmail.com/g' ${ORG}.json.orig > ${ORG}.json.new
gcloud organizations set-iam-policy $PROJECT ${ORG}.json.new
rm -f ${ORG}.json.*
done
done