mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-29 10:21:35 +00:00
Updated gam <UserTypeEntity> print|show groups` to show totals
Some checks failed
Build and test GAM / build (Win64, build, 8, VC-WIN64A, windows-2022) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 2, linux-aarch64, [self-hosted linux arm64]) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 4, linux-aarch64, [self-hosted linux arm64], yes) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 6, darwin64-arm64, macos-14) (push) Has been cancelled
Build and test GAM / build (universal2, build, 7, darwin64-arm64 darwin64-x86_64, macos-14) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 1, linux-x86_64, ubuntu-20.04) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 3, linux-x86_64, ubuntu-20.04, yes) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 5, darwin64-x86_64, macos-12) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 10, ubuntu-22.04, 3.9) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 11, ubuntu-22.04, 3.10) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 12, ubuntu-22.04, 3.11) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 9, ubuntu-22.04, 3.8) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-apis (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
Some checks failed
Build and test GAM / build (Win64, build, 8, VC-WIN64A, windows-2022) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 2, linux-aarch64, [self-hosted linux arm64]) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 4, linux-aarch64, [self-hosted linux arm64], yes) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 6, darwin64-arm64, macos-14) (push) Has been cancelled
Build and test GAM / build (universal2, build, 7, darwin64-arm64 darwin64-x86_64, macos-14) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 1, linux-x86_64, ubuntu-20.04) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 3, linux-x86_64, ubuntu-20.04, yes) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 5, darwin64-x86_64, macos-12) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 10, ubuntu-22.04, 3.9) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 11, ubuntu-22.04, 3.10) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 12, ubuntu-22.04, 3.11) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 9, ubuntu-22.04, 3.8) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-apis (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled
This commit is contained in:
@@ -1994,6 +1994,7 @@ gam revoke browsertoken <BrowserTokenPermanentID>
|
||||
org|
|
||||
orgunit|
|
||||
orgunitpath|
|
||||
ou|
|
||||
revoketime|
|
||||
revokerid|
|
||||
state|
|
||||
@@ -5356,7 +5357,7 @@ gam download storagefile <StorageBucketObjectName>
|
||||
(note clear|([text_html|text_plain] <String>|
|
||||
(file|htmlfile <FileName> [charset <Charset>])|
|
||||
(gdoc|ghtml <UserGoogleDoc>)))|
|
||||
(org|ou|orgunitpath <OrgUnitPath>|<OrgUnitID>)
|
||||
(ou|org|orgunitpath <OrgUnitPath>|<OrgUnitID>)
|
||||
(password (random [<Integer>])|(uniquerandom [<Integer>])|blocklogin|<Password>)|
|
||||
(recoveryemail <EmailAddress>)|
|
||||
(recoveryphone <string>)|
|
||||
@@ -7603,10 +7604,10 @@ gam <UserTypeEntity> check group|groups
|
||||
[roles <GroupRoleList>] [includederivedmembership] [csv] <GroupEntity>
|
||||
gam <UserTypeEntity> print groups [todrive <ToDriveAttribute>*]
|
||||
[(domain <DomainName>)|(customerid <CustomerID>)]
|
||||
[roles <GroupRoleList>] [countsonly|nodetails]
|
||||
[roles <GroupRoleList>] [countsonly|totalonly|nodetails]
|
||||
gam <UserTypeEntity> show groups
|
||||
[(domain <DomainName>)|(customerid <CustomerID>)]
|
||||
[roles <GroupRoleList>] [countsonly|nodetails]
|
||||
[roles <GroupRoleList>] [countsonly|totalonly|nodetails]
|
||||
gam <UserTypeEntity> print grouptree [todrive <ToDriveAttribute>*]
|
||||
[(domain <DomainName>)|(customerid <CustomerID>)]
|
||||
[roles <GroupRoleList>]
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
|
||||
Merged GAM-Team version
|
||||
|
||||
6.79.07
|
||||
|
||||
Added option `totalonly` to `gam <UserTypeEntity> print|show groups` that displays
|
||||
the user email address and the total number of groups to which it belongs. This is in
|
||||
contrast to `countsonly` that has to make an additional API call per group per user to get the user's role.
|
||||
When `countsonly` is specified, an additional column `Total` is displayed that is the sum
|
||||
of the role counts.
|
||||
|
||||
6.79.06
|
||||
|
||||
Fixed bug in `gam calendars <CalendarEntity> update event ... removeattendee <EmailAddress>` that caused a trap
|
||||
|
||||
@@ -63546,7 +63546,7 @@ def createSharedDrive(users, useDomainAdminAccess=False):
|
||||
waitingForCreationToComplete(updateInitialDelay)
|
||||
created = False
|
||||
retry = 0
|
||||
while True:
|
||||
while not created:
|
||||
try:
|
||||
callGAPI(drive.drives(), 'get',
|
||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.NOT_FOUND],
|
||||
@@ -65275,16 +65275,16 @@ def checkUserInGroups(users):
|
||||
|
||||
# gam <UserTypeEntity> print groups [todrive <ToDriveAttribute>*]
|
||||
# [(domain <DomainName>)|(customerid <CustomerID>)]
|
||||
# [roles <GroupRoleList>] [countsonly|nodetails]
|
||||
# [roles <GroupRoleList>] [countsonly|totalonly|nodetails]
|
||||
# gam <UserTypeEntity> show groups
|
||||
# [(domain <DomainName>)|(customerid <CustomerID>)]
|
||||
# [roles <GroupRoleList>] [countsonly|nodetails]
|
||||
# [roles <GroupRoleList>] [countsonly|totalonly|nodetails]
|
||||
def printShowUserGroups(users):
|
||||
cd = buildGAPIObject(API.DIRECTORY)
|
||||
kwargs = {'customer': GC.Values[GC.CUSTOMER_ID]}
|
||||
csvPF = CSVPrintFile(['User', 'Group', 'Role', 'Status', 'Delivery'], 'sortall') if Act.csvFormat() else None
|
||||
rolesSet = set()
|
||||
countsOnly = noDetails = False
|
||||
countsOnly = noDetails = totalOnly = False
|
||||
while Cmd.ArgumentsRemaining():
|
||||
myarg = getArgument()
|
||||
if csvPF and myarg == 'todrive':
|
||||
@@ -65299,6 +65299,8 @@ def printShowUserGroups(users):
|
||||
invalidChoiceExit(role, GROUP_ROLES_MAP, True)
|
||||
elif myarg == 'countsonly':
|
||||
countsOnly = True
|
||||
elif myarg == 'totalonly':
|
||||
countsOnly = totalOnly = True
|
||||
elif myarg == 'nodetails':
|
||||
noDetails = True
|
||||
else:
|
||||
@@ -65312,15 +65314,17 @@ def printShowUserGroups(users):
|
||||
csvPF.SetTitles(titles)
|
||||
csvPF.SetSortTitles([])
|
||||
elif countsOnly:
|
||||
zeroCounts = {'User': None}
|
||||
for role in [Ent.ROLE_MEMBER, Ent.ROLE_MANAGER, Ent.ROLE_OWNER]:
|
||||
if role in rolesSet:
|
||||
zeroCounts[role] = 0
|
||||
if csvPF:
|
||||
titles = ['User']
|
||||
zeroCounts = {'User': None, 'Total': 0}
|
||||
if not totalOnly:
|
||||
for role in [Ent.ROLE_MEMBER, Ent.ROLE_MANAGER, Ent.ROLE_OWNER]:
|
||||
if role in rolesSet:
|
||||
titles.append(role)
|
||||
zeroCounts[role] = 0
|
||||
if csvPF:
|
||||
titles = ['User', 'Total']
|
||||
if not totalOnly:
|
||||
for role in [Ent.ROLE_MEMBER, Ent.ROLE_MANAGER, Ent.ROLE_OWNER]:
|
||||
if role in rolesSet:
|
||||
titles.append(role)
|
||||
csvPF.SetTitles(titles)
|
||||
csvPF.SetSortTitles([])
|
||||
i, count, users = getEntityArgument(users)
|
||||
@@ -65348,6 +65352,12 @@ def printShowUserGroups(users):
|
||||
return
|
||||
accessErrorExit(cd)
|
||||
jcount = len(entityList)
|
||||
if totalOnly:
|
||||
if not csvPF:
|
||||
printEntityKVList([Ent.USER, user], ['Total', jcount])
|
||||
else:
|
||||
csvPF.WriteRow({'User': user, 'Total': jcount})
|
||||
continue
|
||||
if not csvPF:
|
||||
if allRoles:
|
||||
entityPerformActionNumItems([Ent.USER, user], jcount, Ent.GROUP, i, count)
|
||||
@@ -65393,8 +65403,11 @@ def printShowUserGroups(users):
|
||||
except (GAPI.memberNotFound, GAPI.invalidMember, GAPI.conditionNotMet, GAPI.serviceNotAvailable) as e:
|
||||
entityActionFailedWarning([Ent.USER, user, Ent.GROUP, groupEmail], str(e), j, jcount)
|
||||
if countsOnly:
|
||||
for role in [Ent.ROLE_MEMBER, Ent.ROLE_MANAGER, Ent.ROLE_OWNER]:
|
||||
if role in rolesSet:
|
||||
userCounts['Total'] += userCounts[role]
|
||||
if not csvPF:
|
||||
kvList = []
|
||||
kvList = ['Total', userCounts['Total']]
|
||||
for role in [Ent.ROLE_MEMBER, Ent.ROLE_MANAGER, Ent.ROLE_OWNER]:
|
||||
if role in rolesSet:
|
||||
kvList.extend([role, userCounts[role]])
|
||||
|
||||
Reference in New Issue
Block a user