mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-10 14:43:34 +00:00
merge
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
GAM is a command line tool for Google G Suite Administrators to manage domain and user settings quickly and easily. [](https://travis-ci.org/jay0lee/GAM)
|
GAM is a command line tool for Google Workspace (fka G Suite) Administrators to manage domain and user settings quickly and easily. [](https://travis-ci.org/jay0lee/GAM)
|
||||||
# Quick Start
|
# Quick Start
|
||||||
## Linux / MacOS
|
## Linux / MacOS
|
||||||
Open a terminal and run:
|
Open a terminal and run:
|
||||||
|
@ -28,7 +28,7 @@ upgrade_only=false
|
|||||||
gamversion="latest"
|
gamversion="latest"
|
||||||
adminuser=""
|
adminuser=""
|
||||||
regularuser=""
|
regularuser=""
|
||||||
gam_glibc_vers="2.27 2.23"
|
gam_glibc_vers="2.31 2.27 2.23"
|
||||||
gam_macos_vers="10.15.6 10.14.6 10.13.6"
|
gam_macos_vers="10.15.6 10.14.6 10.13.6"
|
||||||
|
|
||||||
while getopts "hd:a:o:b:lp:u:r:v:" OPTION
|
while getopts "hd:a:o:b:lp:u:r:v:" OPTION
|
||||||
@ -288,7 +288,7 @@ while true; do
|
|||||||
case $yn in
|
case $yn in
|
||||||
[Yy]*)
|
[Yy]*)
|
||||||
if [ "$adminuser" == "" ]; then
|
if [ "$adminuser" == "" ]; then
|
||||||
read -p "Please enter your G Suite admin email address: " adminuser
|
read -p "Please enter your Google Workspace admin email address: " adminuser
|
||||||
fi
|
fi
|
||||||
"$target_dir/gam/gam" create project $adminuser
|
"$target_dir/gam/gam" create project $adminuser
|
||||||
rc=$?
|
rc=$?
|
||||||
@ -312,7 +312,7 @@ done
|
|||||||
|
|
||||||
admin_authorized=false
|
admin_authorized=false
|
||||||
while $project_created; do
|
while $project_created; do
|
||||||
read -p "Are you ready to authorize GAM to perform G Suite management operations as your admin account? (yes or no) " yn
|
read -p "Are you ready to authorize GAM to perform Google Workspace management operations as your admin account? (yes or no) " yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]*)
|
[Yy]*)
|
||||||
"$target_dir/gam/gam" oauth create $adminuser
|
"$target_dir/gam/gam" oauth create $adminuser
|
||||||
@ -337,11 +337,11 @@ done
|
|||||||
|
|
||||||
service_account_authorized=false
|
service_account_authorized=false
|
||||||
while $project_created; do
|
while $project_created; do
|
||||||
read -p "Are you ready to authorize GAM to manage G Suite user data and settings? (yes or no) " yn
|
read -p "Are you ready to authorize GAM to manage Google Workspace user data and settings? (yes or no) " yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]*)
|
[Yy]*)
|
||||||
if [ "$regularuser" == "" ]; then
|
if [ "$regularuser" == "" ]; then
|
||||||
read -p "Please enter the email address of a regular G Suite user: " regularuser
|
read -p "Please enter the email address of a regular Google Workspace user: " regularuser
|
||||||
fi
|
fi
|
||||||
echo_yellow "Great! Checking service account scopes.This will fail the first time. Follow the steps to authorize and retry. It can take a few minutes for scopes to PASS after they've been authorized in the admin console."
|
echo_yellow "Great! Checking service account scopes.This will fail the first time. Follow the steps to authorize and retry. It can take a few minutes for scopes to PASS after they've been authorized in the admin console."
|
||||||
"$target_dir/gam/gam" user $adminuser check serviceaccount
|
"$target_dir/gam/gam" user $adminuser check serviceaccount
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
@ goto createproject
|
@ goto createproject
|
||||||
)
|
)
|
||||||
@echo(
|
@echo(
|
||||||
@set /p adminemail= "Please enter your G Suite admin email address: "
|
@set /p adminemail= "Please enter your Google Workspace admin email address: "
|
||||||
@gam create project %adminemail%
|
@gam create project %adminemail%
|
||||||
@if not ERRORLEVEL 1 goto projectdone
|
@if not ERRORLEVEL 1 goto projectdone
|
||||||
@echo(
|
@echo(
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
:adminauth
|
:adminauth
|
||||||
@echo(
|
@echo(
|
||||||
@set /p yn= "Are you ready to authorize GAM to perform G Suite management operations as your admin account? [y or n] "
|
@set /p yn= "Are you ready to authorize GAM to perform Google Workspace management operations as your admin account? [y or n] "
|
||||||
@if /I "%yn%"=="n" (
|
@if /I "%yn%"=="n" (
|
||||||
@ echo(
|
@ echo(
|
||||||
@ echo You can authorize an admin later by running:
|
@ echo You can authorize an admin later by running:
|
||||||
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
:saauth
|
:saauth
|
||||||
@echo(
|
@echo(
|
||||||
@set /p yn= "Are you ready to authorize GAM to manage G Suite user data and settings? [y or n] "
|
@set /p yn= "Are you ready to authorize GAM to manage Google Workspace user data and settings? [y or n] "
|
||||||
@if /I "%yn%"=="n" (
|
@if /I "%yn%"=="n" (
|
||||||
@ echo(
|
@ echo(
|
||||||
@ echo You can authorize a service account later by running:
|
@ echo You can authorize a service account later by running:
|
||||||
@ -73,7 +73,7 @@
|
|||||||
@ goto saauth
|
@ goto saauth
|
||||||
)
|
)
|
||||||
@echo(
|
@echo(
|
||||||
@set /p regularuser= "Please enter the email address of a regular G Suite user: "
|
@set /p regularuser= "Please enter the email address of a regular Google Workspace user: "
|
||||||
@echo Great! Checking service account scopes. This will fail the first time. Follow the steps to authorize and retry. It can take a few minutes for scopes to PASS after they've been authorized in the admin console.
|
@echo Great! Checking service account scopes. This will fail the first time. Follow the steps to authorize and retry. It can take a few minutes for scopes to PASS after they've been authorized in the admin console.
|
||||||
@gam user %regularuser% check serviceaccount
|
@gam user %regularuser% check serviceaccount
|
||||||
@if not ERRORLEVEL 1 goto sadone
|
@if not ERRORLEVEL 1 goto sadone
|
||||||
|
@ -3538,7 +3538,11 @@ def getDriveFileAttribute(i, body, parameters, myarg, update=False):
|
|||||||
sys.argv[i+2], f'gam <users> {operation} drivefile')
|
sys.argv[i+2], f'gam <users> {operation} drivefile')
|
||||||
i += 3
|
i += 3
|
||||||
if len(sys.argv) > i and sys.argv[i].lower() == 'reason':
|
if len(sys.argv) > i and sys.argv[i].lower() == 'reason':
|
||||||
|
if body['contentRestrictions'][0]['readOnly']:
|
||||||
body['contentRestrictions'][0]['reason'] = sys.argv[i+1]
|
body['contentRestrictions'][0]['reason'] = sys.argv[i+1]
|
||||||
|
else:
|
||||||
|
controlflow.invalid_argument_exit(
|
||||||
|
'reason', 'contentrestrictions readonly false')
|
||||||
i += 2
|
i += 2
|
||||||
else:
|
else:
|
||||||
controlflow.invalid_argument_exit(
|
controlflow.invalid_argument_exit(
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
"""GAM is a command line tool which allows Administrators to control their G Suite domain and accounts.
|
"""GAM is a command line tool which allows Administrators to control their Google Workspace domain and accounts.
|
||||||
|
|
||||||
With GAM you can programmatically create users, turn on/off services for users like POP and Forwarding and much more.
|
With GAM you can programmatically create users, turn on/off services for users like POP and Forwarding and much more.
|
||||||
For more information, see https://git.io/gam
|
For more information, see https://git.io/gam
|
||||||
|
@ -237,6 +237,11 @@ def print_():
|
|||||||
for groupEntity in entityList:
|
for groupEntity in entityList:
|
||||||
i += 1
|
i += 1
|
||||||
groupEmail = groupEntity['groupKey']['id']
|
groupEmail = groupEntity['groupKey']['id']
|
||||||
|
for k, v in iter(groupEntity.pop('labels', {}).items()):
|
||||||
|
if v == '':
|
||||||
|
groupEntity[f'labels.{k}'] = True
|
||||||
|
else:
|
||||||
|
groupEntity[f'labels.{k}'] = v
|
||||||
group = utils.flatten_json(groupEntity)
|
group = utils.flatten_json(groupEntity)
|
||||||
for a_key in group:
|
for a_key in group:
|
||||||
if a_key not in titles:
|
if a_key not in titles:
|
||||||
@ -304,7 +309,7 @@ def print_():
|
|||||||
csvRows.append(group)
|
csvRows.append(group)
|
||||||
if sortHeaders:
|
if sortHeaders:
|
||||||
display.sort_csv_titles([
|
display.sort_csv_titles([
|
||||||
'Email',
|
'name', 'groupKey.id'
|
||||||
], titles)
|
], titles)
|
||||||
display.write_csv_file(csvRows, titles, 'Groups', todrive)
|
display.write_csv_file(csvRows, titles, 'Groups', todrive)
|
||||||
|
|
||||||
|
@ -184,5 +184,5 @@ def update():
|
|||||||
pass
|
pass
|
||||||
print()
|
print()
|
||||||
print(
|
print(
|
||||||
f'You can now add {a_domain} or it\'s subdomains as secondary or domain aliases of the {GC_Values[GC_DOMAIN]} G Suite Account.'
|
f'You can now add {a_domain} or it\'s subdomains as secondary or domain aliases of the {GC_Values[GC_DOMAIN]} Google Workspace Account.'
|
||||||
)
|
)
|
||||||
|
@ -161,7 +161,7 @@ SKUS = {
|
|||||||
'1010340001': {
|
'1010340001': {
|
||||||
'product': '101034',
|
'product': '101034',
|
||||||
'aliases': ['gseau', 'enterprisearchived', 'gsuiteenterprisearchived'],
|
'aliases': ['gseau', 'enterprisearchived', 'gsuiteenterprisearchived'],
|
||||||
'displayName': 'G Suite Enterprise Archived'
|
'displayName': 'Google Workspace Enterprise Plus Archived'
|
||||||
},
|
},
|
||||||
'Google-Drive-storage-20GB': {
|
'Google-Drive-storage-20GB': {
|
||||||
'product': 'Google-Drive-storage',
|
'product': 'Google-Drive-storage',
|
||||||
@ -231,7 +231,7 @@ PRODUCTID_NAME_MAPPINGS = {
|
|||||||
'101031': 'G Suite Enterprise for Education',
|
'101031': 'G Suite Enterprise for Education',
|
||||||
'101033': 'Google Voice',
|
'101033': 'Google Voice',
|
||||||
'101034': 'G Suite Archived',
|
'101034': 'G Suite Archived',
|
||||||
'Google-Apps': 'G Suite',
|
'Google-Apps': 'Google Workspace',
|
||||||
'Google-Chrome-Device-Management': 'Google Chrome Device Management',
|
'Google-Chrome-Device-Management': 'Google Chrome Device Management',
|
||||||
'Google-Coordinate': 'Google Coordinate',
|
'Google-Coordinate': 'Google Coordinate',
|
||||||
'Google-Drive-storage': 'Google Drive Storage',
|
'Google-Drive-storage': 'Google Drive Storage',
|
||||||
@ -401,6 +401,7 @@ DRIVEFILE_FIELDS_CHOICES_MAP = {
|
|||||||
'appdatacontents': 'appDataContents',
|
'appdatacontents': 'appDataContents',
|
||||||
'cancomment': 'canComment',
|
'cancomment': 'canComment',
|
||||||
'canreadrevisions': 'canReadRevisions',
|
'canreadrevisions': 'canReadRevisions',
|
||||||
|
'contentrestrictions': 'contentRestrictions',
|
||||||
'copyable': 'copyable',
|
'copyable': 'copyable',
|
||||||
'copyrequireswriterpermission': 'copyRequiresWriterPermission',
|
'copyrequireswriterpermission': 'copyRequiresWriterPermission',
|
||||||
'createddate': 'createdDate',
|
'createddate': 'createdDate',
|
||||||
@ -520,6 +521,7 @@ MIMETYPE_GA_SCRIPT = f'{APPLICATION_VND_GOOGLE_APPS}script'
|
|||||||
MIMETYPE_GA_SITES = f'{APPLICATION_VND_GOOGLE_APPS}sites'
|
MIMETYPE_GA_SITES = f'{APPLICATION_VND_GOOGLE_APPS}sites'
|
||||||
MIMETYPE_GA_SPREADSHEET = f'{APPLICATION_VND_GOOGLE_APPS}spreadsheet'
|
MIMETYPE_GA_SPREADSHEET = f'{APPLICATION_VND_GOOGLE_APPS}spreadsheet'
|
||||||
MIMETYPE_GA_SHORTCUT = f'{APPLICATION_VND_GOOGLE_APPS}shortcut'
|
MIMETYPE_GA_SHORTCUT = f'{APPLICATION_VND_GOOGLE_APPS}shortcut'
|
||||||
|
MIMETYPE_GA_3P_SHORTCUT = f'{APPLICATION_VND_GOOGLE_APPS}drive-sdk'
|
||||||
|
|
||||||
MIMETYPE_CHOICES_MAP = {
|
MIMETYPE_CHOICES_MAP = {
|
||||||
'gdoc': MIMETYPE_GA_DOCUMENT,
|
'gdoc': MIMETYPE_GA_DOCUMENT,
|
||||||
@ -531,6 +533,8 @@ MIMETYPE_CHOICES_MAP = {
|
|||||||
'gfusion': MIMETYPE_GA_FUSIONTABLE,
|
'gfusion': MIMETYPE_GA_FUSIONTABLE,
|
||||||
'gpresentation': MIMETYPE_GA_PRESENTATION,
|
'gpresentation': MIMETYPE_GA_PRESENTATION,
|
||||||
'gscript': MIMETYPE_GA_SCRIPT,
|
'gscript': MIMETYPE_GA_SCRIPT,
|
||||||
|
'gshortcut': MIMETYPE_GA_SHORTCUT,
|
||||||
|
'g3pshortcut': MIMETYPE_GA_3P_SHORTCUT,
|
||||||
'gsite': MIMETYPE_GA_SITES,
|
'gsite': MIMETYPE_GA_SITES,
|
||||||
'gsheet': MIMETYPE_GA_SPREADSHEET,
|
'gsheet': MIMETYPE_GA_SPREADSHEET,
|
||||||
'gspreadsheet': MIMETYPE_GA_SPREADSHEET,
|
'gspreadsheet': MIMETYPE_GA_SPREADSHEET,
|
||||||
|
Reference in New Issue
Block a user