gam7 7.23.4__py3-none-any.whl → 7.23.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gam7 might be problematic. Click here for more details.
- gam/__init__.py +69 -28
- {gam7-7.23.4.dist-info → gam7-7.23.5.dist-info}/METADATA +1 -1
- {gam7-7.23.4.dist-info → gam7-7.23.5.dist-info}/RECORD +6 -6
- {gam7-7.23.4.dist-info → gam7-7.23.5.dist-info}/WHEEL +0 -0
- {gam7-7.23.4.dist-info → gam7-7.23.5.dist-info}/entry_points.txt +0 -0
- {gam7-7.23.4.dist-info → gam7-7.23.5.dist-info}/licenses/LICENSE +0 -0
gam/__init__.py
CHANGED
|
@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
|
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
|
28
|
-
__version__ = '7.23.
|
|
28
|
+
__version__ = '7.23.05'
|
|
29
29
|
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
|
30
30
|
|
|
31
31
|
#pylint: disable=wrong-import-position
|
|
@@ -16995,16 +16995,17 @@ ASSIGNEE_EMAILTYPE_TOFIELD_MAP = {
|
|
|
16995
16995
|
'group': 'assignedToGroup',
|
|
16996
16996
|
'serviceaccount': 'assignedToServiceAccount',
|
|
16997
16997
|
}
|
|
16998
|
-
PRINT_ADMIN_FIELDS = ['roleAssignmentId', 'roleId', 'assignedTo', 'scopeType', 'orgUnitId']
|
|
16998
|
+
PRINT_ADMIN_FIELDS = ['roleAssignmentId', 'roleId', 'assignedTo', 'scopeType', 'orgUnitId', 'assigneeType']
|
|
16999
16999
|
PRINT_ADMIN_TITLES = ['roleAssignmentId', 'roleId', 'role',
|
|
17000
17000
|
'assignedTo', 'assignedToUser', 'assignedToGroup', 'assignedToServiceAccount', 'assignedToUnknown',
|
|
17001
17001
|
'scopeType', 'orgUnitId', 'orgUnit']
|
|
17002
17002
|
|
|
17003
17003
|
# gam print admins [todrive <ToDriveAttribute>*]
|
|
17004
|
-
# [user|group <EmailAddress>|<UniqueID>] [role <RoleItem>]
|
|
17005
|
-
# [privileges] [oneitemperrow]
|
|
17004
|
+
# [user|group <EmailAddress>|<UniqueID>] [role <RoleItem>]
|
|
17005
|
+
# [recursive] [condition] [privileges] [oneitemperrow]
|
|
17006
17006
|
# gam show admins
|
|
17007
|
-
# [user|group <EmailAddress>|<UniqueID>] [role <RoleItem>]
|
|
17007
|
+
# [user|group <EmailAddress>|<UniqueID>] [role <RoleItem>]
|
|
17008
|
+
# [recursive] [condition] [privileges]
|
|
17008
17009
|
def doPrintShowAdmins():
|
|
17009
17010
|
def _getPrivileges(admin):
|
|
17010
17011
|
if showPrivileges:
|
|
@@ -17031,15 +17032,12 @@ def doPrintShowAdmins():
|
|
|
17031
17032
|
def _setNamesFromIds(admin, privileges):
|
|
17032
17033
|
admin['role'] = role_from_roleid(admin['roleId'])
|
|
17033
17034
|
assignedTo = admin['assignedTo']
|
|
17034
|
-
admin['assignedToUnknown'] = False
|
|
17035
17035
|
if assignedTo not in assignedToIdEmailMap:
|
|
17036
|
-
assigneeType = admin.get('assigneeType')
|
|
17037
|
-
assignedToField = ASSIGNEE_EMAILTYPE_TOFIELD_MAP.get(assigneeType, None)
|
|
17038
17036
|
assigneeEmail, assigneeType = convertUIDtoEmailAddressWithType(f'uid:{assignedTo}', cd, sal,
|
|
17039
|
-
emailTypes=
|
|
17040
|
-
if
|
|
17037
|
+
emailTypes=allAssigneeTypes if admin.get('assigneeType') != 'group' else ['group'])
|
|
17038
|
+
if assigneeType in ASSIGNEE_EMAILTYPE_TOFIELD_MAP:
|
|
17041
17039
|
assignedToField = ASSIGNEE_EMAILTYPE_TOFIELD_MAP[assigneeType]
|
|
17042
|
-
|
|
17040
|
+
else:
|
|
17043
17041
|
assignedToField = 'assignedToUnknown'
|
|
17044
17042
|
assigneeEmail = True
|
|
17045
17043
|
assignedToIdEmailMap[assignedTo] = {'assignedToField': assignedToField, 'assigneeEmail': assigneeEmail}
|
|
@@ -17059,11 +17057,12 @@ def doPrintShowAdmins():
|
|
|
17059
17057
|
csvPF = CSVPrintFile(PRINT_ADMIN_TITLES) if Act.csvFormat() else None
|
|
17060
17058
|
roleId = None
|
|
17061
17059
|
userKey = None
|
|
17062
|
-
oneItemPerRow = showPrivileges = False
|
|
17060
|
+
oneItemPerRow = recursive = showPrivileges = False
|
|
17063
17061
|
kwargs = {}
|
|
17064
17062
|
rolePrivileges = {}
|
|
17065
17063
|
fieldsList = PRINT_ADMIN_FIELDS
|
|
17066
17064
|
assignedToIdEmailMap = {}
|
|
17065
|
+
allAssigneeTypes = list(ASSIGNEE_EMAILTYPE_TOFIELD_MAP.keys())
|
|
17067
17066
|
while Cmd.ArgumentsRemaining():
|
|
17068
17067
|
myarg = getArgument()
|
|
17069
17068
|
if csvPF and myarg == 'todrive':
|
|
@@ -17072,6 +17071,15 @@ def doPrintShowAdmins():
|
|
|
17072
17071
|
userKey = kwargs['userKey'] = getEmailAddress()
|
|
17073
17072
|
elif myarg == 'role':
|
|
17074
17073
|
_, roleId = getRoleId()
|
|
17074
|
+
elif myarg == 'recursive':
|
|
17075
|
+
recursive = True
|
|
17076
|
+
allGroupRoles = ','.join(sorted(ALL_GROUP_ROLES))
|
|
17077
|
+
memberOptions = initMemberOptions()
|
|
17078
|
+
memberOptions[MEMBEROPTION_INCLUDEDERIVEDMEMBERSHIP] = True
|
|
17079
|
+
memberOptions[MEMBEROPTION_DISPLAYMATCH] = False
|
|
17080
|
+
memberDisplayOptions = initIPSGMGroupMemberDisplayOptions()
|
|
17081
|
+
for role in [Ent.ROLE_MEMBER, Ent.ROLE_MANAGER, Ent.ROLE_OWNER]:
|
|
17082
|
+
memberDisplayOptions[role]['show'] = True
|
|
17075
17083
|
elif myarg == 'condition':
|
|
17076
17084
|
fieldsList.append('condition')
|
|
17077
17085
|
if csvPF:
|
|
@@ -17091,7 +17099,7 @@ def doPrintShowAdmins():
|
|
|
17091
17099
|
admins = callGAPIpages(cd.roleAssignments(), 'list', 'items',
|
|
17092
17100
|
pageMessage=getPageMessage(),
|
|
17093
17101
|
throwReasons=[GAPI.INVALID, GAPI.USER_NOT_FOUND,
|
|
17094
|
-
GAPI.FORBIDDEN, GAPI.SERVICE_NOT_AVAILABLE,
|
|
17102
|
+
GAPI.NOT_FOUND, GAPI.FORBIDDEN, GAPI.SERVICE_NOT_AVAILABLE,
|
|
17095
17103
|
GAPI.BAD_REQUEST, GAPI.CUSTOMER_NOT_FOUND,
|
|
17096
17104
|
GAPI.FORBIDDEN, GAPI.PERMISSION_DENIED],
|
|
17097
17105
|
retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS,
|
|
@@ -17099,39 +17107,72 @@ def doPrintShowAdmins():
|
|
|
17099
17107
|
except (GAPI.invalid, GAPI.userNotFound):
|
|
17100
17108
|
entityUnknownWarning(Ent.ADMINISTRATOR, userKey)
|
|
17101
17109
|
return
|
|
17102
|
-
except
|
|
17103
|
-
entityActionFailedExit([Ent.
|
|
17110
|
+
except GAPI.notFound as e:
|
|
17111
|
+
entityActionFailedExit([Ent.ADMIN_ROLE, kwargs['roleId']], str(e))
|
|
17112
|
+
except (GAPI.forbidden, GAPI.serviceNotAvailable) as e:
|
|
17113
|
+
entityActionFailedExit([Ent.ADMINISTRATOR, userKey], str(e))
|
|
17104
17114
|
except (GAPI.badRequest, GAPI.customerNotFound):
|
|
17105
17115
|
accessErrorExit(cd)
|
|
17106
17116
|
except (GAPI.forbidden, GAPI.permissionDenied) as e:
|
|
17107
17117
|
ClientAPIAccessDeniedExit(str(e))
|
|
17118
|
+
count = len(admins)
|
|
17119
|
+
groupMembers = {}
|
|
17120
|
+
expandedAdmins = []
|
|
17121
|
+
i = 0
|
|
17122
|
+
for admin in admins:
|
|
17123
|
+
i += 1
|
|
17124
|
+
if roleId and roleId != admin['roleId']:
|
|
17125
|
+
continue
|
|
17126
|
+
if admin['assigneeType'] != 'group' or not recursive:
|
|
17127
|
+
_setNamesFromIds(admin, _getPrivileges(admin))
|
|
17128
|
+
expandedAdmins.append(admin)
|
|
17129
|
+
continue
|
|
17130
|
+
assignedTo = admin['assignedTo']
|
|
17131
|
+
if assignedTo not in groupMembers:
|
|
17132
|
+
membersList = []
|
|
17133
|
+
membersSet = set()
|
|
17134
|
+
level = 0
|
|
17135
|
+
getGroupMembers(cd, assignedTo, allGroupRoles, membersList, membersSet, i, count,
|
|
17136
|
+
memberOptions, memberDisplayOptions, level, {Ent.TYPE_USER})
|
|
17137
|
+
groupMembers[assignedTo] = membersList[:]
|
|
17138
|
+
_setNamesFromIds(admin, _getPrivileges(admin))
|
|
17139
|
+
if not groupMembers[assignedTo]:
|
|
17140
|
+
expandedAdmins.append(admin)
|
|
17141
|
+
continue
|
|
17142
|
+
admin['assigneeType'] = 'user'
|
|
17143
|
+
admin['assignedToGroup'] = assignedToIdEmailMap[assignedTo]['assigneeEmail']
|
|
17144
|
+
for member in groupMembers[assignedTo]:
|
|
17145
|
+
userAdmin = admin.copy()
|
|
17146
|
+
userAdmin['assignedTo'] = member['id']
|
|
17147
|
+
_setNamesFromIds(userAdmin, _getPrivileges(admin))
|
|
17148
|
+
expandedAdmins.append(userAdmin)
|
|
17149
|
+
admins = expandedAdmins
|
|
17150
|
+
count = len(expandedAdmins)
|
|
17108
17151
|
if not csvPF:
|
|
17109
|
-
count = len(admins)
|
|
17110
17152
|
performActionNumItems(count, Ent.ADMIN_ROLE_ASSIGNMENT)
|
|
17111
17153
|
Ind.Increment()
|
|
17112
17154
|
i = 0
|
|
17113
|
-
for admin in
|
|
17155
|
+
for admin in expandedAdmins:
|
|
17114
17156
|
i += 1
|
|
17115
|
-
if roleId and roleId != admin['roleId']:
|
|
17116
|
-
continue
|
|
17117
|
-
_setNamesFromIds(admin, _getPrivileges(admin))
|
|
17118
17157
|
printEntity([Ent.ADMIN_ROLE_ASSIGNMENT, admin['roleAssignmentId']], i, count)
|
|
17119
17158
|
Ind.Increment()
|
|
17120
17159
|
for field in PRINT_ADMIN_TITLES:
|
|
17121
17160
|
if field in admin:
|
|
17122
17161
|
if field == 'roleAssignmentId':
|
|
17123
17162
|
continue
|
|
17124
|
-
|
|
17125
|
-
|
|
17126
|
-
|
|
17127
|
-
|
|
17163
|
+
printKeyValueList([field, admin[field]])
|
|
17164
|
+
if showPrivileges:
|
|
17165
|
+
rolePrivileges = admin.get('rolePrivileges', [])
|
|
17166
|
+
jcount = len(rolePrivileges)
|
|
17167
|
+
if jcount > 0:
|
|
17168
|
+
printKeyValueList(['rolePrivileges', jcount])
|
|
17169
|
+
Ind.Increment()
|
|
17170
|
+
showJSON(None, rolePrivileges)
|
|
17171
|
+
Ind.Decrement()
|
|
17128
17172
|
Ind.Decrement()
|
|
17129
17173
|
Ind.Decrement()
|
|
17130
17174
|
else:
|
|
17131
|
-
for admin in
|
|
17132
|
-
if roleId and roleId != admin['roleId']:
|
|
17133
|
-
continue
|
|
17134
|
-
_setNamesFromIds(admin, _getPrivileges(admin))
|
|
17175
|
+
for admin in expandedAdmins:
|
|
17135
17176
|
if not oneItemPerRow or 'rolePrivileges' not in admin:
|
|
17136
17177
|
csvPF.WriteRowTitles(flattenJSON(admin))
|
|
17137
17178
|
else:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
gam/__init__.py,sha256=
|
|
1
|
+
gam/__init__.py,sha256=azObku-kchg7drgmBFc3imztILTag7nTTt2PSx-l-Cs,3622295
|
|
2
2
|
gam/__main__.py,sha256=amz0-959ph6zkZKqjaar4n60yho-T37w6qWI36qx0CA,1049
|
|
3
3
|
gam/cacerts.pem,sha256=DUsVo2XlFYwfkhe3gnxa-Km4Z4noz74hSApXwTT-nQE,44344
|
|
4
4
|
gam/cbcm-v1.1beta1.json,sha256=xO5XloCQQULmPbFBx5bckdqmbLFQ7sJ2TImhE1ysDIY,19439
|
|
@@ -47,8 +47,8 @@ gam/gdata/apps/audit/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrK
|
|
|
47
47
|
gam/gdata/apps/audit/service.py,sha256=Z1eueThcNeVUMWP1DRWc_DGHrJCiJI8W_xj6L-cqu-Q,9658
|
|
48
48
|
gam/gdata/apps/contacts/__init__.py,sha256=Um6zgIkiahZns7yAEuC3pxHSMD8iciZ_EoynSLoYPfU,30463
|
|
49
49
|
gam/gdata/apps/contacts/service.py,sha256=5lNb-Ii1Gyek6ePFji3kyoYtCBc8CuJTwagx2BL2o14,15684
|
|
50
|
-
gam7-7.23.
|
|
51
|
-
gam7-7.23.
|
|
52
|
-
gam7-7.23.
|
|
53
|
-
gam7-7.23.
|
|
54
|
-
gam7-7.23.
|
|
50
|
+
gam7-7.23.5.dist-info/METADATA,sha256=4fCdZBo8CEvLYKB3C5MxtUIMeqGHc4DZCPHUN3oPdh8,3092
|
|
51
|
+
gam7-7.23.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
52
|
+
gam7-7.23.5.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
|
|
53
|
+
gam7-7.23.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
54
|
+
gam7-7.23.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|