Skip to content

Commit

Permalink
Issue #1722
Browse files Browse the repository at this point in the history
  • Loading branch information
taers232c committed Nov 27, 2024
1 parent f29c697 commit 84d0414
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions src/GamUpdate.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
7.01.03

Fixed bug in `gam update cigroups <GroupEntity> delete|sync|update` where `cbcm-browser` and `chrome-os_device`
addresses were not properly handled.

7.01.02

Added option `positivecountsonly` to `gam <UserTypeEntity> print|show filecomments` that causes
Expand Down
20 changes: 12 additions & 8 deletions src/gam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"""

__author__ = 'GAM Team <[email protected]>'
__version__ = '7.01.02'
__version__ = '7.01.03'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'

#pylint: disable=wrong-import-position
Expand Down Expand Up @@ -5729,8 +5729,10 @@ def convertUIDtoEmailAddressWithType(emailAddressOrUID, cd=None, sal=None, email
# Convert UID to email address
def convertUIDtoEmailAddress(emailAddressOrUID, cd=None, emailTypes=None,
checkForCustomerId=False, ciGroupsAPI=False, aliasAllowed=True):
if emailAddressOrUID.startswith('cbcm-browser.'):
return emailAddressOrUID
if ciGroupsAPI:
normalizedEmailAddressOrUID = normalizeEmailAddressOrUID(emailAddressOrUID, ciGroupsAPI=ciGroupsAPI)
if normalizedEmailAddressOrUID.startswith('cbcm-browser.') or normalizedEmailAddressOrUID.startswith('chrome-os-device.'):
return normalizedEmailAddressOrUID
email, _ = convertUIDtoEmailAddressWithType(emailAddressOrUID, cd, emailTypes,
checkForCustomerId, ciGroupsAPI, aliasAllowed)
return email
Expand Down Expand Up @@ -34639,7 +34641,7 @@ def _batchRemoveGroupMembers(group, i, count, removeMembers, role):
continue
_batchAddGroupMembers(parent, i, count,
[convertUIDtoEmailAddress(member, cd=cd, emailTypes='any',
checkForCustomerId=True) for member in addMembers],
checkForCustomerId=True, ciGroupsAPI=True) for member in addMembers],
role, expireTime)
elif CL_subCommand in {'delete', 'remove'}:
baseRole, groupMemberType = _getRoleGroupMemberType()
Expand Down Expand Up @@ -34681,11 +34683,12 @@ def _batchRemoveGroupMembers(group, i, count, removeMembers, role):
j = 0
for member in removeMembers:
j += 1
memberEmail = convertUIDtoEmailAddress(member, cd=cd, emailTypes='any', checkForCustomerId=True)
memberEmail = convertUIDtoEmailAddress(member, cd=cd, emailTypes='any',
checkForCustomerId=True, ciGroupsAPI=True)
try:
memberName = callGAPI(ci.groups().memberships(), 'lookup',
throwReasons=GAPI.CIGROUP_GET_THROW_REASONS,
parent=parent, memberKey_id=member, fields='name').get('name')
parent=parent, memberKey_id=memberEmail, fields='name').get('name')
callGAPI(ci.groups().memberships(), 'delete',
throwReasons=GAPI.MEMBERS_THROW_REASONS+[GAPI.FAILED_PRECONDITION],
name=memberName)
Expand Down Expand Up @@ -34714,7 +34717,7 @@ def _batchRemoveGroupMembers(group, i, count, removeMembers, role):
syncMembersMaps[baseRole] = {}
for member in syncMembers:
syncMembersSets[baseRole].add(_cleanConsumerAddress(convertUIDtoEmailAddress(member, cd=cd, emailTypes='any',
checkForCustomerId=True), syncMembersMaps[baseRole]))
checkForCustomerId=True, ciGroupsAPI=True), syncMembersMaps[baseRole]))
checkForExtraneousArguments()
i = 0
count = len(entityList)
Expand Down Expand Up @@ -34836,7 +34839,8 @@ def _batchRemoveGroupMembers(group, i, count, removeMembers, role):
j = 0
for member in updateMembers:
j += 1
memberEmail = convertUIDtoEmailAddress(member, cd=cd, emailTypes='any', checkForCustomerId=True)
memberEmail = convertUIDtoEmailAddress(member, cd=cd, emailTypes='any',
checkForCustomerId=True, ciGroupsAPI=True)
try:
memberName = callGAPI(ci.groups().memberships(), 'lookup',
throwReasons=GAPI.CIGROUP_GET_THROW_REASONS,
Expand Down

0 comments on commit 84d0414

Please sign in to comment.