mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-29 18:31:38 +00:00
Added commands to display Business Profile Accounts. #1807
This commit is contained in:
@@ -3436,6 +3436,13 @@ gam print guardian|guardians [todrive <ToDriveAttribute>*] [accepted|invitations
|
|||||||
[showstudentemails]
|
[showstudentemails]
|
||||||
[formatjson [quotechar <Character>]]
|
[formatjson [quotechar <Character>]]
|
||||||
|
|
||||||
|
# Business Profile Accounts
|
||||||
|
|
||||||
|
gam show businessprofileaccounts
|
||||||
|
[type locationgroup|organization|personal|usergroup]
|
||||||
|
gam print businessprofileaccounts [todrive <ToDriveAttribute>*]
|
||||||
|
[type locationgroup|organization|personal|usergroup]
|
||||||
|
|
||||||
# Classroom User Profiles
|
# Classroom User Profiles
|
||||||
|
|
||||||
gam <UserTypeEntity> print classroomprofile [todrive <ToDriveAttribute>*]
|
gam <UserTypeEntity> print classroomprofile [todrive <ToDriveAttribute>*]
|
||||||
|
|||||||
@@ -1,7 +1,16 @@
|
|||||||
|
7.18.00
|
||||||
|
|
||||||
|
Added commands to display Business Profile Accounts.
|
||||||
|
These are special purpose commands and will not generally be used.
|
||||||
|
```
|
||||||
|
gam show businessprofileaccounts
|
||||||
|
gam print businessprofileaccounts [todrive <ToDriveAttribute>*]
|
||||||
|
```
|
||||||
|
|
||||||
7.17.03
|
7.17.03
|
||||||
|
|
||||||
Fixed bug in gam <UserItem> print|show chatspaces asadmin fields <ChatSpaceFieldNameList>` that caused a trap
|
Fixed bug in `gam <UserItem> print|show chatspaces asadmin fields <ChatSpaceFieldNameList>` that caused a trap
|
||||||
when `isplayname` was not in `<ChatSpaceFieldNameList>`.
|
when `displayname` was not in `<ChatSpaceFieldNameList>`.
|
||||||
|
|
||||||
7.17.02
|
7.17.02
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
||||||
__version__ = '7.17.03'
|
__version__ = '7.18.00'
|
||||||
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
||||||
|
|
||||||
#pylint: disable=wrong-import-position
|
#pylint: disable=wrong-import-position
|
||||||
@@ -5579,7 +5579,12 @@ def buildGAPIObject(api, credentials=None):
|
|||||||
try:
|
try:
|
||||||
API_Scopes = set(list(service._rootDesc['auth']['oauth2']['scopes']))
|
API_Scopes = set(list(service._rootDesc['auth']['oauth2']['scopes']))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
API_Scopes = set(API.VAULT_SCOPES) if api == API.VAULT else set()
|
if api == API.VAULT:
|
||||||
|
API_Scopes = set(API.VAULT_SCOPES)
|
||||||
|
elif api == API.BUSINESSACCOUNTMANAGEMENT:
|
||||||
|
API_Scopes = {API.BUSINESSACCOUNTMANAGEMENT_SCOPE}
|
||||||
|
else:
|
||||||
|
API_Scopes = set()
|
||||||
GM.Globals[GM.CURRENT_CLIENT_API] = api
|
GM.Globals[GM.CURRENT_CLIENT_API] = api
|
||||||
GM.Globals[GM.CURRENT_CLIENT_API_SCOPES] = API_Scopes.intersection(GM.Globals[GM.CREDENTIALS_SCOPES])
|
GM.Globals[GM.CURRENT_CLIENT_API_SCOPES] = API_Scopes.intersection(GM.Globals[GM.CREDENTIALS_SCOPES])
|
||||||
if api not in API.SCOPELESS_APIS and not GM.Globals[GM.CURRENT_CLIENT_API_SCOPES]:
|
if api not in API.SCOPELESS_APIS and not GM.Globals[GM.CURRENT_CLIENT_API_SCOPES]:
|
||||||
@@ -47069,6 +47074,51 @@ def doUpdateSiteVerification():
|
|||||||
_showSiteVerificationInfo(verify_result)
|
_showSiteVerificationInfo(verify_result)
|
||||||
printKeyValueList([Msg.YOU_CAN_ADD_DOMAIN_TO_ACCOUNT.format(a_domain, GC.Values[GC.DOMAIN])])
|
printKeyValueList([Msg.YOU_CAN_ADD_DOMAIN_TO_ACCOUNT.format(a_domain, GC.Values[GC.DOMAIN])])
|
||||||
|
|
||||||
|
PROFILE_ACCOUNT_TYPE_MAP = {
|
||||||
|
'locationgroup': 'LOCATION_GROUP',
|
||||||
|
'organization': 'ORGANIZATION',
|
||||||
|
'personal': 'PERSONAL',
|
||||||
|
'usergroup': 'USER_GROUP',
|
||||||
|
}
|
||||||
|
|
||||||
|
# gam show businessprofileaccounts
|
||||||
|
# [type locationgroup|organization|personal|usergroup]
|
||||||
|
# gam print businessprofileaccounts [todrive <ToDriveAttribute>*]
|
||||||
|
# [type locationgroup|organization|personal|usergroup]
|
||||||
|
def doPrintShowBusinessProfileAccounts():
|
||||||
|
bp = buildGAPIObject(API.BUSINESSACCOUNTMANAGEMENT)
|
||||||
|
csvPF = CSVPrintFile(['name', 'accountName']) if Act.csvFormat() else None
|
||||||
|
kwargs = {}
|
||||||
|
while Cmd.ArgumentsRemaining():
|
||||||
|
myarg = getArgument()
|
||||||
|
if csvPF and myarg == 'todrive':
|
||||||
|
csvPF.GetTodriveParameters()
|
||||||
|
elif myarg == 'type':
|
||||||
|
kwargs['filter'] = f'type={getChoice(PROFILE_ACCOUNT_TYPE_MAP, mapChoice=True)}'
|
||||||
|
else:
|
||||||
|
unknownArgumentExit()
|
||||||
|
try:
|
||||||
|
accounts = callGAPIpages(bp.accounts(), 'list', 'accounts',
|
||||||
|
throwReasons=[GAPI.PERMISSION_DENIED],
|
||||||
|
**kwargs)
|
||||||
|
except GAPI.permissionDenied as e:
|
||||||
|
accessErrorExitNonDirectory(API.BUSINESSACCOUNTMANAGEMENT, str(e))
|
||||||
|
if not csvPF:
|
||||||
|
count = len(accounts)
|
||||||
|
i = 0
|
||||||
|
for account in sorted(accounts, key=lambda k: k['name']):
|
||||||
|
i += 1
|
||||||
|
printKeyValueListWithCount(['Account', account['name']], i, count)
|
||||||
|
Ind.Increment()
|
||||||
|
showJSON(None, account)
|
||||||
|
Ind.Decrement()
|
||||||
|
else:
|
||||||
|
for account in accounts:
|
||||||
|
row = flattenJSON(account, flattened={'name': account['name'], 'accountName': account['accountName']})
|
||||||
|
csvPF.WriteRowTitles(row)
|
||||||
|
if csvPF:
|
||||||
|
csvPF.writeCSVfile('Business Profile Accounts')
|
||||||
|
|
||||||
# gam info verify|verification
|
# gam info verify|verification
|
||||||
def doInfoSiteVerification():
|
def doInfoSiteVerification():
|
||||||
verif = buildGAPIObject(API.SITEVERIFICATION)
|
verif = buildGAPIObject(API.SITEVERIFICATION)
|
||||||
@@ -77237,6 +77287,7 @@ MAIN_COMMANDS_WITH_OBJECTS = {
|
|||||||
Cmd.ARG_BROWSER: doPrintShowBrowsers,
|
Cmd.ARG_BROWSER: doPrintShowBrowsers,
|
||||||
Cmd.ARG_BROWSERTOKEN: doPrintShowBrowserTokens,
|
Cmd.ARG_BROWSERTOKEN: doPrintShowBrowserTokens,
|
||||||
Cmd.ARG_BUILDING: doPrintShowBuildings,
|
Cmd.ARG_BUILDING: doPrintShowBuildings,
|
||||||
|
Cmd.ARG_BUSINESSPROFILEACCOUNT: doPrintShowBusinessProfileAccounts,
|
||||||
Cmd.ARG_CAALEVEL: doPrintShowCAALevels,
|
Cmd.ARG_CAALEVEL: doPrintShowCAALevels,
|
||||||
Cmd.ARG_CHANNELCUSTOMER: doPrintShowChannelCustomers,
|
Cmd.ARG_CHANNELCUSTOMER: doPrintShowChannelCustomers,
|
||||||
Cmd.ARG_CHANNELCUSTOMERENTITLEMENT: doPrintShowChannelCustomerEntitlements,
|
Cmd.ARG_CHANNELCUSTOMERENTITLEMENT: doPrintShowChannelCustomerEntitlements,
|
||||||
@@ -77370,6 +77421,7 @@ MAIN_COMMANDS_WITH_OBJECTS = {
|
|||||||
Cmd.ARG_BROWSER: doPrintShowBrowsers,
|
Cmd.ARG_BROWSER: doPrintShowBrowsers,
|
||||||
Cmd.ARG_BROWSERTOKEN: doPrintShowBrowserTokens,
|
Cmd.ARG_BROWSERTOKEN: doPrintShowBrowserTokens,
|
||||||
Cmd.ARG_BUILDING: doPrintShowBuildings,
|
Cmd.ARG_BUILDING: doPrintShowBuildings,
|
||||||
|
Cmd.ARG_BUSINESSPROFILEACCOUNT: doPrintShowBusinessProfileAccounts,
|
||||||
Cmd.ARG_CAALEVEL: doPrintShowCAALevels,
|
Cmd.ARG_CAALEVEL: doPrintShowCAALevels,
|
||||||
Cmd.ARG_CHANNELCUSTOMER: doPrintShowChannelCustomers,
|
Cmd.ARG_CHANNELCUSTOMER: doPrintShowChannelCustomers,
|
||||||
Cmd.ARG_CHANNELCUSTOMERENTITLEMENT: doPrintShowChannelCustomerEntitlements,
|
Cmd.ARG_CHANNELCUSTOMERENTITLEMENT: doPrintShowChannelCustomerEntitlements,
|
||||||
@@ -77556,6 +77608,7 @@ MAIN_COMMANDS_OBJ_ALIASES = {
|
|||||||
Cmd.ARG_BUCKET: Cmd.ARG_STORAGEBUCKET,
|
Cmd.ARG_BUCKET: Cmd.ARG_STORAGEBUCKET,
|
||||||
Cmd.ARG_BUCKETS: Cmd.ARG_STORAGEBUCKET,
|
Cmd.ARG_BUCKETS: Cmd.ARG_STORAGEBUCKET,
|
||||||
Cmd.ARG_BUILDINGS: Cmd.ARG_BUILDING,
|
Cmd.ARG_BUILDINGS: Cmd.ARG_BUILDING,
|
||||||
|
Cmd.ARG_BUSINESSPROFILEACCOUNTS: Cmd.ARG_BUSINESSPROFILEACCOUNT,
|
||||||
Cmd.ARG_CAALEVELS: Cmd.ARG_CAALEVEL,
|
Cmd.ARG_CAALEVELS: Cmd.ARG_CAALEVEL,
|
||||||
Cmd.ARG_CHATMEMBERS: Cmd.ARG_CHATMEMBER,
|
Cmd.ARG_CHATMEMBERS: Cmd.ARG_CHATMEMBER,
|
||||||
Cmd.ARG_CHANNELCUSTOMERS: Cmd.ARG_CHANNELCUSTOMER,
|
Cmd.ARG_CHANNELCUSTOMERS: Cmd.ARG_CHANNELCUSTOMER,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ ACCESSCONTEXTMANAGER = 'accesscontextmanager'
|
|||||||
ALERTCENTER = 'alertcenter'
|
ALERTCENTER = 'alertcenter'
|
||||||
ANALYTICS_ADMIN = 'analyticsadmin'
|
ANALYTICS_ADMIN = 'analyticsadmin'
|
||||||
CALENDAR = 'calendar'
|
CALENDAR = 'calendar'
|
||||||
|
BUSINESSACCOUNTMANAGEMENT = 'mybusinessaccountmanagement'
|
||||||
CBCM = 'cbcm'
|
CBCM = 'cbcm'
|
||||||
CHAT = 'chat'
|
CHAT = 'chat'
|
||||||
CHAT_CUSTOM_EMOJIS = 'chatcustomemojis'
|
CHAT_CUSTOM_EMOJIS = 'chatcustomemojis'
|
||||||
@@ -101,6 +102,7 @@ TASKS = 'tasks'
|
|||||||
VAULT = 'vault'
|
VAULT = 'vault'
|
||||||
YOUTUBE = 'youtube'
|
YOUTUBE = 'youtube'
|
||||||
#
|
#
|
||||||
|
BUSINESSACCOUNTMANAGEMENT_SCOPE = 'https://www.googleapis.com/auth/business.manage'
|
||||||
CHROMEVERSIONHISTORY_URL = 'https://versionhistory.googleapis.com/v1/chrome/platforms'
|
CHROMEVERSIONHISTORY_URL = 'https://versionhistory.googleapis.com/v1/chrome/platforms'
|
||||||
DRIVE_SCOPE = 'https://www.googleapis.com/auth/drive'
|
DRIVE_SCOPE = 'https://www.googleapis.com/auth/drive'
|
||||||
GMAIL_SEND_SCOPE = 'https://www.googleapis.com/auth/gmail.send'
|
GMAIL_SEND_SCOPE = 'https://www.googleapis.com/auth/gmail.send'
|
||||||
@@ -174,6 +176,7 @@ PROJECT_APIS = [
|
|||||||
'alertcenter.googleapis.com',
|
'alertcenter.googleapis.com',
|
||||||
'analyticsadmin.googleapis.com',
|
'analyticsadmin.googleapis.com',
|
||||||
# 'audit.googleapis.com',
|
# 'audit.googleapis.com',
|
||||||
|
'mybusinessaccountmanagement.googleapis.com',
|
||||||
'calendar-json.googleapis.com',
|
'calendar-json.googleapis.com',
|
||||||
'chat.googleapis.com',
|
'chat.googleapis.com',
|
||||||
'chromemanagement.googleapis.com',
|
'chromemanagement.googleapis.com',
|
||||||
@@ -213,6 +216,7 @@ _INFO = {
|
|||||||
ACCESSCONTEXTMANAGER: {'name': 'Access Context Manager API', 'version': 'v1', 'v2discovery': True},
|
ACCESSCONTEXTMANAGER: {'name': 'Access Context Manager API', 'version': 'v1', 'v2discovery': True},
|
||||||
ALERTCENTER: {'name': 'AlertCenter API', 'version': 'v1beta1', 'v2discovery': True},
|
ALERTCENTER: {'name': 'AlertCenter API', 'version': 'v1beta1', 'v2discovery': True},
|
||||||
ANALYTICS_ADMIN: {'name': 'Analytics Admin API', 'version': 'v1beta', 'v2discovery': True},
|
ANALYTICS_ADMIN: {'name': 'Analytics Admin API', 'version': 'v1beta', 'v2discovery': True},
|
||||||
|
BUSINESSACCOUNTMANAGEMENT: {'name': 'Business Account Management API', 'version': 'v1', 'v2discovery': True},
|
||||||
CALENDAR: {'name': 'Calendar API', 'version': 'v3', 'v2discovery': True, 'mappedAPI': 'calendar-json'},
|
CALENDAR: {'name': 'Calendar API', 'version': 'v3', 'v2discovery': True, 'mappedAPI': 'calendar-json'},
|
||||||
CBCM: {'name': 'Chrome Browser Cloud Management API', 'version': 'v1.1beta1', 'v2discovery': True, 'localjson': True},
|
CBCM: {'name': 'Chrome Browser Cloud Management API', 'version': 'v1.1beta1', 'v2discovery': True, 'localjson': True},
|
||||||
CHAT: {'name': 'Chat API', 'version': 'v1', 'v2discovery': True},
|
CHAT: {'name': 'Chat API', 'version': 'v1', 'v2discovery': True},
|
||||||
@@ -293,6 +297,11 @@ _INFO = {
|
|||||||
READONLY = ['readonly',]
|
READONLY = ['readonly',]
|
||||||
|
|
||||||
_CLIENT_SCOPES = [
|
_CLIENT_SCOPES = [
|
||||||
|
{'name': 'Business Account Management API',
|
||||||
|
'api': BUSINESSACCOUNTMANAGEMENT,
|
||||||
|
'subscopes': [],
|
||||||
|
'offByDefault': True,
|
||||||
|
'scope': BUSINESSACCOUNTMANAGEMENT_SCOPE},
|
||||||
{'name': 'Calendar API',
|
{'name': 'Calendar API',
|
||||||
'api': CALENDAR,
|
'api': CALENDAR,
|
||||||
'subscopes': READONLY,
|
'subscopes': READONLY,
|
||||||
|
|||||||
@@ -441,6 +441,8 @@ class GamCLArgs():
|
|||||||
ARG_BUCKETS = 'buckets'
|
ARG_BUCKETS = 'buckets'
|
||||||
ARG_BUILDING = 'building'
|
ARG_BUILDING = 'building'
|
||||||
ARG_BUILDINGS = 'buildings'
|
ARG_BUILDINGS = 'buildings'
|
||||||
|
ARG_BUSINESSPROFILEACCOUNT = 'businessprofileaccount'
|
||||||
|
ARG_BUSINESSPROFILEACCOUNTS = 'businessprofileaccounts'
|
||||||
ARG_CAALEVEL = 'caalevel'
|
ARG_CAALEVEL = 'caalevel'
|
||||||
ARG_CAALEVELS = 'caalevels'
|
ARG_CAALEVELS = 'caalevels'
|
||||||
ARG_CALATTENDEES = 'calattendees'
|
ARG_CALATTENDEES = 'calattendees'
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class GamEntity():
|
|||||||
BACKUP_VERIFICATION_CODES = 'buvc'
|
BACKUP_VERIFICATION_CODES = 'buvc'
|
||||||
BUILDING = 'bldg'
|
BUILDING = 'bldg'
|
||||||
BUILDING_ID = 'bldi'
|
BUILDING_ID = 'bldi'
|
||||||
|
BUSINESS_PROFILE_ACCOUNT = 'bpac'
|
||||||
CAA_LEVEL = 'calv'
|
CAA_LEVEL = 'calv'
|
||||||
CALENDAR = 'cale'
|
CALENDAR = 'cale'
|
||||||
CALENDAR_ACL = 'cacl'
|
CALENDAR_ACL = 'cacl'
|
||||||
@@ -434,6 +435,7 @@ class GamEntity():
|
|||||||
BACKUP_VERIFICATION_CODES: ['Backup Verification Codes', 'Backup Verification Codes'],
|
BACKUP_VERIFICATION_CODES: ['Backup Verification Codes', 'Backup Verification Codes'],
|
||||||
BUILDING: ['Buildings', 'Building'],
|
BUILDING: ['Buildings', 'Building'],
|
||||||
BUILDING_ID: ['Building IDs', 'Building ID'],
|
BUILDING_ID: ['Building IDs', 'Building ID'],
|
||||||
|
BUSINESS_PROFILE_ACCOUNT: ['Business Profile Accounts', 'Business Profile Account'],
|
||||||
CAA_LEVEL: ['CAA Levels', 'CAA Level'],
|
CAA_LEVEL: ['CAA Levels', 'CAA Level'],
|
||||||
CALENDAR: ['Calendars', 'Calendar'],
|
CALENDAR: ['Calendars', 'Calendar'],
|
||||||
CALENDAR_ACL: ['Calendar ACLs', 'Calendar ACL'],
|
CALENDAR_ACL: ['Calendar ACLs', 'Calendar ACL'],
|
||||||
|
|||||||
Reference in New Issue
Block a user