This commit is contained in:
Ross Scroggs
2020-09-30 06:43:42 -07:00
committed by GitHub
parent e28f2fb8cd
commit 57860dc5a6

View File

@@ -7,7 +7,6 @@ from gam import display
from gam import gapi from gam import gapi
from gam.gapi import directory as gapi_directory from gam.gapi import directory as gapi_directory
from gam.gapi import errors as gapi_errors from gam.gapi import errors as gapi_errors
from gam import utils
def create(): def create():
@@ -229,11 +228,11 @@ def update():
if sys.argv[4].lower() in ['move', 'add']: if sys.argv[4].lower() in ['move', 'add']:
entity_type = sys.argv[5].lower() entity_type = sys.argv[5].lower()
if entity_type in usergroup_types: if entity_type in usergroup_types:
users = getUsersToModify(entity_type=entity_type, users = gam.getUsersToModify(entity_type=entity_type,
entity=sys.argv[6]) entity=sys.argv[6])
else: else:
entity_type = 'users' entity_type = 'users'
users = getUsersToModify(entity_type=entity_type, users = gam.getUsersToModify(entity_type=entity_type,
entity=sys.argv[5]) entity=sys.argv[5])
if (entity_type.startswith('cros')) or ( if (entity_type.startswith('cros')) or (
(entity_type == 'all') and (sys.argv[6].lower() == 'cros')): (entity_type == 'all') and (sys.argv[6].lower() == 'cros')):
@@ -253,7 +252,7 @@ def update():
for user in users: for user in users:
i += 1 i += 1
sys.stderr.write( sys.stderr.write(
f' moving {user} to {orgUnitPath}{currentCountNL(i, count)}' f' moving {user} to {orgUnitPath}{gam.currentCountNL(i, count)}'
) )
try: try:
gapi.call(cd.users(), gapi.call(cd.users(),
@@ -377,7 +376,7 @@ def getTopLevelOrgId(cd, orgUnitPath):
def getOrgUnitId(orgUnit, cd=None): def getOrgUnitId(orgUnit, cd=None):
if cd is None: if cd is None:
cd = buildGAPIObject('directory') cd = gapi_directory.build()
orgUnit = getOrgUnitItem(orgUnit) orgUnit = getOrgUnitItem(orgUnit)
if orgUnit[:3] == 'id:': if orgUnit[:3] == 'id:':
return (orgUnit, orgUnit) return (orgUnit, orgUnit)