gam7 7.27.3__py3-none-any.whl → 7.27.4__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 +96 -30
- gam/gamlib/glmsgs.py +2 -0
- {gam7-7.27.3.dist-info → gam7-7.27.4.dist-info}/METADATA +1 -1
- {gam7-7.27.3.dist-info → gam7-7.27.4.dist-info}/RECORD +7 -7
- {gam7-7.27.3.dist-info → gam7-7.27.4.dist-info}/WHEEL +0 -0
- {gam7-7.27.3.dist-info → gam7-7.27.4.dist-info}/entry_points.txt +0 -0
- {gam7-7.27.3.dist-info → gam7-7.27.4.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.27.
|
|
28
|
+
__version__ = '7.27.04'
|
|
29
29
|
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
|
30
30
|
|
|
31
31
|
#pylint: disable=wrong-import-position
|
|
@@ -44236,6 +44236,28 @@ USER_JSON_SKIP_FIELDS = ['agreedToTerms', 'aliases', 'creationTime', 'customerId
|
|
|
44236
44236
|
|
|
44237
44237
|
ALLOW_EMPTY_CUSTOM_TYPE = 'allowEmptyCustomType'
|
|
44238
44238
|
|
|
44239
|
+
def getNotifyArguments(myarg, notify, userNotification):
|
|
44240
|
+
if myarg == 'notify':
|
|
44241
|
+
if userNotification:
|
|
44242
|
+
notify['recipients'].extend(getNormalizedEmailAddressEntity(shlexSplit=True, noLower=True))
|
|
44243
|
+
else: #delegateNotificatiomn
|
|
44244
|
+
notify['notify'] = getBoolean()
|
|
44245
|
+
elif myarg == 'subject':
|
|
44246
|
+
notify['subject'] = getString(Cmd.OB_STRING)
|
|
44247
|
+
elif myarg in SORF_MSG_FILE_ARGUMENTS:
|
|
44248
|
+
notify['message'], notify['charset'], notify['html'] = getStringOrFile(myarg)
|
|
44249
|
+
elif myarg == 'html':
|
|
44250
|
+
notify['html'] = getBoolean()
|
|
44251
|
+
elif myarg == 'from':
|
|
44252
|
+
notify['from'] = getString(Cmd.OB_EMAIL_ADDRESS)
|
|
44253
|
+
elif myarg == 'mailbox':
|
|
44254
|
+
notify['mailbox'] = getString(Cmd.OB_EMAIL_ADDRESS)
|
|
44255
|
+
elif myarg == 'replyto':
|
|
44256
|
+
notify['replyto'] = getString(Cmd.OB_EMAIL_ADDRESS)
|
|
44257
|
+
else:
|
|
44258
|
+
return False
|
|
44259
|
+
return True
|
|
44260
|
+
|
|
44239
44261
|
def getUserAttributes(cd, updateCmd, noUid=False):
|
|
44240
44262
|
def getKeywordAttribute(keywords, attrdict, **opts):
|
|
44241
44263
|
if Cmd.ArgumentsRemaining():
|
|
@@ -44351,22 +44373,10 @@ def getUserAttributes(cd, updateCmd, noUid=False):
|
|
|
44351
44373
|
resolveConflictAccount = True
|
|
44352
44374
|
while Cmd.ArgumentsRemaining():
|
|
44353
44375
|
myarg = getArgument()
|
|
44354
|
-
if myarg
|
|
44355
|
-
|
|
44376
|
+
if getNotifyArguments(myarg, notify, True):
|
|
44377
|
+
pass
|
|
44356
44378
|
elif myarg == 'notifyrecoveryemail':
|
|
44357
44379
|
parameters['notifyRecoveryEmail'] = True
|
|
44358
|
-
elif myarg == 'subject':
|
|
44359
|
-
notify['subject'] = getString(Cmd.OB_STRING)
|
|
44360
|
-
elif myarg in SORF_MSG_FILE_ARGUMENTS:
|
|
44361
|
-
notify['message'], notify['charset'], notify['html'] = getStringOrFile(myarg)
|
|
44362
|
-
elif myarg == 'html':
|
|
44363
|
-
notify['html'] = getBoolean()
|
|
44364
|
-
elif myarg == 'from':
|
|
44365
|
-
notify['from'] = getString(Cmd.OB_EMAIL_ADDRESS)
|
|
44366
|
-
elif myarg == 'replyto':
|
|
44367
|
-
notify['replyto'] = getString(Cmd.OB_EMAIL_ADDRESS)
|
|
44368
|
-
elif myarg == 'mailbox':
|
|
44369
|
-
notify['mailbox'] = getString(Cmd.OB_EMAIL_ADDRESS)
|
|
44370
44380
|
elif PwdOpts.ProcessArgument(myarg, notify, notFoundBody):
|
|
44371
44381
|
pass
|
|
44372
44382
|
elif _getTagReplacement(myarg, tagReplacements, True):
|
|
@@ -44772,12 +44782,12 @@ def createUserAddAliases(cd, user, aliasList, i, count):
|
|
|
44772
44782
|
# [license <SKUID> [product|productid <ProductID>]]
|
|
44773
44783
|
# [[notify <EmailAddressList>] [notifyrecoveryemail]
|
|
44774
44784
|
# [subject <String>]
|
|
44775
|
-
# [
|
|
44776
|
-
# [from <EmailAaddress>]
|
|
44785
|
+
# [from <EmailAaddress>] [mailbox <EmailAddress>]
|
|
44777
44786
|
# [replyto <EmailAaddress>]
|
|
44778
|
-
# [<
|
|
44779
|
-
#
|
|
44780
|
-
#
|
|
44787
|
+
# [notifypassword <String>]
|
|
44788
|
+
# [<NotifyMessageContent>] [html [<Boolean>]]
|
|
44789
|
+
# (replace <Tag> <UserReplacement>)*
|
|
44790
|
+
# (replaceregex <REMatchPattern> <RESubstitution> <Tag> <UserReplacement>)*]
|
|
44781
44791
|
# [logpassword <FileName>] [ignorenullpassword]
|
|
44782
44792
|
# [addnumericsuffixonduplicate <Number>]
|
|
44783
44793
|
def doCreateUser():
|
|
@@ -44876,12 +44886,12 @@ def verifyUserPrimaryEmail(cd, user, createIfNotFound, i, count):
|
|
|
44876
44886
|
# [alias|aliases <EmailAddressList>]
|
|
44877
44887
|
# [[notify <EmailAddressList>] [notifyrecoveryemail]
|
|
44878
44888
|
# [subject <String>]
|
|
44879
|
-
# [
|
|
44880
|
-
# [from <EmailAaddress>]
|
|
44889
|
+
# [from <EmailAaddress>] [mailbox <EmailAddress>]
|
|
44881
44890
|
# [replyto <EmailAaddress>]
|
|
44882
|
-
# [<NotifyMessageContent>
|
|
44891
|
+
# [<NotifyMessageContent> [html [<Boolean>]]
|
|
44883
44892
|
# (replace <Tag> <UserReplacement>)*
|
|
44884
44893
|
# (replaceregex <REMatchPattern> <RESubstitution> <Tag> <UserReplacement>)*]
|
|
44894
|
+
# [notifypassword <String>]]
|
|
44885
44895
|
# [notifyonupdate [<Boolean>]]
|
|
44886
44896
|
# [logpassword <FileName>] [ignorenullpassword]
|
|
44887
44897
|
def updateUsers(entityList):
|
|
@@ -73923,14 +73933,58 @@ def printShowMessages(users):
|
|
|
73923
73933
|
def printShowThreads(users):
|
|
73924
73934
|
printShowMessagesThreads(users, Ent.THREAD)
|
|
73925
73935
|
|
|
73936
|
+
def sendCreateDelegateNotification(user, delegate, basenotify, i=0, count=0, msgFrom=None):
|
|
73937
|
+
# Substitute for #user#, #delegate#
|
|
73938
|
+
def _substituteForPattern(field, pattern, value):
|
|
73939
|
+
if field.find('#') == -1:
|
|
73940
|
+
return field
|
|
73941
|
+
return field.replace(pattern, value)
|
|
73942
|
+
|
|
73943
|
+
def _makeSubstitutions(field):
|
|
73944
|
+
notify[field] = _substituteForPattern(notify[field], '#user#', user)
|
|
73945
|
+
notify[field] = _substituteForPattern(notify[field], '#delegate#', delegate)
|
|
73946
|
+
|
|
73947
|
+
notify = basenotify.copy()
|
|
73948
|
+
if not notify['subject']:
|
|
73949
|
+
notify['subject'] = Msg.CREATE_DELEGATE_NOTIFY_SUBJECT
|
|
73950
|
+
_makeSubstitutions('subject')
|
|
73951
|
+
if not notify['message']:
|
|
73952
|
+
notify['message'] = Msg.CREATE_DELEGATE_NOTIFY_MESSAGE
|
|
73953
|
+
elif notify['html']:
|
|
73954
|
+
notify['message'] = notify['message'].replace('\r', '').replace('\\n', '<br/>')
|
|
73955
|
+
else:
|
|
73956
|
+
notify['message'] = notify['message'].replace('\r', '').replace('\\n', '\n')
|
|
73957
|
+
_makeSubstitutions('message')
|
|
73958
|
+
if 'from' in notify:
|
|
73959
|
+
msgFrom = notify['from']
|
|
73960
|
+
msgReplyTo = notify.get('replyto', None)
|
|
73961
|
+
mailBox = notify.get('mailbox', None)
|
|
73962
|
+
send_email(notify['subject'], notify['message'], delegate, i, count,
|
|
73963
|
+
msgFrom=msgFrom, msgReplyTo=msgReplyTo, html=notify['html'], charset=notify['charset'], mailBox=mailBox)
|
|
73964
|
+
|
|
73926
73965
|
# gam <UserTypeEntity> create delegate|delegates [convertalias] <UserEntity>
|
|
73966
|
+
# [notify [<Boolean>]
|
|
73967
|
+
# [subject <String>]
|
|
73968
|
+
# [from <EmailAaddress>] [mailbox <EmailAddress>]
|
|
73969
|
+
# [replyto <EmailAaddress>]
|
|
73970
|
+
# [<NotifyMessageContent>] [html [<Boolean>]]
|
|
73971
|
+
# ]
|
|
73927
73972
|
# gam <UserTypeEntity> delete delegate|delegates [convertalias] <UserEntity>
|
|
73928
73973
|
def processDelegates(users):
|
|
73929
73974
|
cd = buildGAPIObject(API.DIRECTORY)
|
|
73930
|
-
|
|
73975
|
+
createCmd = Act.Get() != Act.DELETE
|
|
73931
73976
|
aliasAllowed = not checkArgumentPresent(['convertalias'])
|
|
73932
73977
|
delegateEntity = getUserObjectEntity(Cmd.OB_USER_ENTITY, Ent.DELEGATE)
|
|
73933
|
-
|
|
73978
|
+
notify = {'notify': False, 'subject': '', 'message': '', 'html': False, 'charset': UTF8}
|
|
73979
|
+
if createCmd:
|
|
73980
|
+
while Cmd.ArgumentsRemaining():
|
|
73981
|
+
myarg = getArgument()
|
|
73982
|
+
if getNotifyArguments(myarg, notify, False):
|
|
73983
|
+
pass
|
|
73984
|
+
else:
|
|
73985
|
+
unknownArgumentExit()
|
|
73986
|
+
else:
|
|
73987
|
+
checkForExtraneousArguments()
|
|
73934
73988
|
i, count, users = getEntityArgument(users)
|
|
73935
73989
|
for user in users:
|
|
73936
73990
|
i += 1
|
|
@@ -73942,25 +73996,37 @@ def processDelegates(users):
|
|
|
73942
73996
|
for delegate in delegates:
|
|
73943
73997
|
j += 1
|
|
73944
73998
|
delegateEmail = convertUIDtoEmailAddress(delegate, cd=cd, emailTypes=['user', 'group'], aliasAllowed=aliasAllowed)
|
|
73999
|
+
kvList = [Ent.USER, user, Ent.DELEGATE, delegateEmail]
|
|
73945
74000
|
try:
|
|
73946
|
-
if
|
|
73947
|
-
callGAPI(gmail.users().settings().delegates(),
|
|
74001
|
+
if createCmd:
|
|
74002
|
+
callGAPI(gmail.users().settings().delegates(), 'create',
|
|
73948
74003
|
throwReasons=GAPI.GMAIL_THROW_REASONS+[GAPI.ALREADY_EXISTS, GAPI.FAILED_PRECONDITION, GAPI.INVALID,
|
|
73949
74004
|
GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED],
|
|
73950
74005
|
userId='me', body={'delegateEmail': delegateEmail})
|
|
74006
|
+
entityActionPerformed(kvList, j, jcount)
|
|
74007
|
+
if notify['notify']:
|
|
74008
|
+
Ind.Increment()
|
|
74009
|
+
sendCreateDelegateNotification(user, delegateEmail, notify, j, jcount)
|
|
74010
|
+
Ind.Decrement()
|
|
73951
74011
|
else:
|
|
73952
|
-
callGAPI(gmail.users().settings().delegates(),
|
|
74012
|
+
callGAPI(gmail.users().settings().delegates(), 'delete',
|
|
73953
74013
|
throwReasons=GAPI.GMAIL_THROW_REASONS+[GAPI.NOT_FOUND, GAPI.INVALID_INPUT, GAPI.PERMISSION_DENIED],
|
|
73954
74014
|
userId='me', delegateEmail=delegateEmail)
|
|
73955
|
-
|
|
74015
|
+
entityActionPerformed(kvList, j, jcount)
|
|
73956
74016
|
except (GAPI.alreadyExists, GAPI.failedPrecondition, GAPI.invalid,
|
|
73957
74017
|
GAPI.notFound, GAPI.invalidArgument, GAPI.permissionDenied) as e:
|
|
73958
|
-
entityActionFailedWarning(
|
|
74018
|
+
entityActionFailedWarning(kvList, str(e), j, jcount)
|
|
73959
74019
|
except GAPI.serviceNotAvailable:
|
|
73960
74020
|
userGmailServiceNotEnabledWarning(user, i, count)
|
|
73961
74021
|
Ind.Decrement()
|
|
73962
74022
|
|
|
73963
74023
|
# gam <UserTypeEntity> delegate to [convertalias] <UserEntity>
|
|
74024
|
+
# [notify [<Boolean>]
|
|
74025
|
+
# [subject <String>]
|
|
74026
|
+
# [from <EmailAaddress>] [mailbox <EmailAddress>]
|
|
74027
|
+
# [replyto <EmailAaddress>]
|
|
74028
|
+
# [<NotifyMessageContent>] [html [<Boolean>]]
|
|
74029
|
+
# ]
|
|
73964
74030
|
def delegateTo(users):
|
|
73965
74031
|
checkArgumentPresent('to', required=True)
|
|
73966
74032
|
processDelegates(users)
|
gam/gamlib/glmsgs.py
CHANGED
|
@@ -224,6 +224,8 @@ COUNT_N_EXCEEDS_MAX_TO_PROCESS_M = 'Count {0} exceeds maximum to {1} {2}'
|
|
|
224
224
|
CORRUPT_FILE = 'Corrupt file'
|
|
225
225
|
COULD_NOT_FIND_ANY_YUBIKEY = 'Could not find any YubiKey\n'
|
|
226
226
|
COULD_NOT_FIND_YUBIKEY_WITH_SERIAL = 'Could not find YubiKey with serial number {0}\n'
|
|
227
|
+
CREATE_DELEGATE_NOTIFY_MESSAGE = '#user# has granted you #delegate# access to read, delete and send mail on their behalf.'
|
|
228
|
+
CREATE_DELEGATE_NOTIFY_SUBJECT = '#user# mail delegation to #delegate#'
|
|
227
229
|
CREATE_USER_NOTIFY_MESSAGE = 'Hello #givenname# #familyname#,\n\nYou have a new account at #domain#\nAccount details:\nUsername: #user#\nPassword: #password#\nStart using your new account by signing in at\nhttps://www.google.com/accounts/AccountChooser?Email=#user#&continue=https://workspace.google.com/dashboard\n'
|
|
228
230
|
CREATE_USER_NOTIFY_SUBJECT = 'Welcome to #domain#'
|
|
229
231
|
CSV_DATA_ALREADY_SAVED = 'CSV data already saved'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
gam/__init__.py,sha256=
|
|
1
|
+
gam/__init__.py,sha256=ezWRtUli0pIMM9dMgTN_FzHCzS5NalnUjOQRio_zJmo,3629588
|
|
2
2
|
gam/__main__.py,sha256=VwEYS7a9vYQPbT6iLduMOoVUJ6p4R-HZgerZQmM1NpE,1307
|
|
3
3
|
gam/cacerts.pem,sha256=DUsVo2XlFYwfkhe3gnxa-Km4Z4noz74hSApXwTT-nQE,44344
|
|
4
4
|
gam/cbcm-v1.1beta1.json,sha256=xO5XloCQQULmPbFBx5bckdqmbLFQ7sJ2TImhE1ysDIY,19439
|
|
@@ -30,7 +30,7 @@ gam/gamlib/glgapi.py,sha256=pdBbwNtnCwFWxJGaP-_3hdTjSNoOCJF2yo76WdQOi1k,40426
|
|
|
30
30
|
gam/gamlib/glgdata.py,sha256=weRppttWm6uRyqtBoGPKoHiNZ2h28nhfUV4J_mbCszY,2707
|
|
31
31
|
gam/gamlib/glglobals.py,sha256=U1eCXHOkWAtwVXG8-0HL4ZzQP0YcbeFlhJxbOa_x1QI,9804
|
|
32
32
|
gam/gamlib/glindent.py,sha256=RfBa2LDfLIqPLL5vMfC689TCVmqn8xf-qulSzkiatrc,1228
|
|
33
|
-
gam/gamlib/glmsgs.py,sha256=
|
|
33
|
+
gam/gamlib/glmsgs.py,sha256=TkLg6p8o9elVIbe_4Kq0hac6qSM-qoIMuQvXoEn4Q_c,34254
|
|
34
34
|
gam/gamlib/glskus.py,sha256=29vlBLBJCL4u9GawCt3eNeZq9HQG3hGFZk9-EainNng,15384
|
|
35
35
|
gam/gamlib/gluprop.py,sha256=IyPLCyvn7-NHTUenM71YPQPXRZXx6CB5q-GtJ-FYd1c,11461
|
|
36
36
|
gam/gamlib/glverlibs.py,sha256=mDphdXVN_dJlGUVGuLqOEA3yHBNBeqRV4DRoTX7Wl7A,982
|
|
@@ -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.27.
|
|
51
|
-
gam7-7.27.
|
|
52
|
-
gam7-7.27.
|
|
53
|
-
gam7-7.27.
|
|
54
|
-
gam7-7.27.
|
|
50
|
+
gam7-7.27.4.dist-info/METADATA,sha256=xxXl0dxVoU3Qr_D_k38_AeeyLfP0smoiVPSFbIcSpzs,3093
|
|
51
|
+
gam7-7.27.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
52
|
+
gam7-7.27.4.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
|
|
53
|
+
gam7-7.27.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
54
|
+
gam7-7.27.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|