Skip to content

Commit

Permalink
Fix info|delete domaincontacts
Browse files Browse the repository at this point in the history
  • Loading branch information
taers232c committed May 17, 2021
1 parent 6166f69 commit 87d6dd5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
5 changes: 4 additions & 1 deletion src/GamCommands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3072,6 +3072,10 @@ gam show orgtree [fromparent <OrgUnitItem>] [batchsuborgs [<Boolean>]]
userdefined
<PeopleFieldNameList> ::= "<PeopleFieldName>(,<PeopleFieldName>)*"

gam delete domaincontacts <PeopleResourceNameEntity>
gam info domaincontacts <PeopleResourceNameEntity>
[allfields|(fields <PeopleFieldNameList>)]
[formatjson]
gam print domaincontacts [todrive <ToDriveAttribute>*]
[query <String>]
[mergesources <PeopleMergeSourceName>]
Expand All @@ -3083,7 +3087,6 @@ gam show domaincontacts
[allfields|(fields <PeopleFieldNameList>)]
[formatjson]

gam delete domainprofiles <PeopleResourceNameEntity>
gam info domainprofiles <PeopleResourceNameEntity>
[allfields|(fields <PeopleFieldNameList>)]
[formatjson]
Expand Down
4 changes: 2 additions & 2 deletions src/GamUpdate.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
6.03.18

Added commands to delete specific domain profiles and user's contacts using the People API.
Added commands to delete specific domain contacts and user's contacts using the People API.
```
gam delete domainprofiles <PeopleResourceNameEntity>
gam delete domaincontacts <PeopleResourceNameEntity>
gam <UserTypeEntity> delete peoplecontacts <PeopleResourceNameEntity>
```
* https://github.com/taers232c/GAMADV-XTD3/wiki/People
Expand Down
28 changes: 17 additions & 11 deletions src/gam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33047,11 +33047,11 @@ def _deletePeople(users, entityType):
ClientAPIAccessDeniedExit()
Ind.Decrement()

# gam delete domainprofiles <ContactEntity>|<ContactSelection>
def doDeletePeopleDomainProfiles():
# gam delete domaincontacts <PeopleResourceNameEntity>
def doDeletePeopleDomainContacts():
_deletePeople([GC.Values[GC.DOMAIN]], Ent.DOMAIN)

# gam <UserTypeEntity> delete peoplecontacts <ContactEntity>|<UserContactSelection>
# gam <UserTypeEntity> delete peoplecontacts <PeopleResourceNameEntity>
def deletePeopleContacts(users):
_deletePeople(users, Ent.USER)

Expand Down Expand Up @@ -33181,6 +33181,8 @@ def printShowPeopleProfile(users):
PEOPLE_READ_SOURCES_CHOICE_MAP = {
'contact': 'READ_SOURCE_TYPE_CONTACT',
'contacts': 'READ_SOURCE_TYPE_CONTACT',
'domaincontact': 'READ_SOURCE_TYPE_DOMAIN_CONTACT',
'domaincontacts': 'READ_SOURCE_TYPE_DOMAIN_CONTACT',
'profile': 'READ_SOURCE_TYPE_PROFILE',
'profiles': 'READ_SOURCE_TYPE_PROFILE'
}
Expand All @@ -33190,18 +33192,16 @@ def printShowPeopleProfile(users):
'contacts': 'DIRECTORY_MERGE_SOURCE_TYPE_CONTACT',
}

def _infoPeople(users, entityType):
def _infoPeople(users, entityType, source):
if entityType == Ent.DOMAIN:
people = buildGAPIObject(API.PEOPLE_DIRECTORY)
source = 'profile'
peopleEntityType = Ent.DOMAIN_PROFILE
peopleEntityType = Ent.DOMAIN_PROFILE if source == 'profile' else Ent.DOMAIN_CONTACT
else:
source = 'contact'
peopleEntityType = Ent.PEOPLE_CONTACT
sources = [PEOPLE_READ_SOURCES_CHOICE_MAP[source]]
entityList = getEntityList(Cmd.OB_CONTACT_ENTITY)
resourceNameLists = entityList if isinstance(entityList, dict) else None
FJQC = FormatJSONQuoteChar()
sources = [PEOPLE_READ_SOURCES_CHOICE_MAP[source]]
fieldsList = []
while Cmd.ArgumentsRemaining():
myarg = getArgument()
Expand Down Expand Up @@ -33245,15 +33245,20 @@ def _infoPeople(users, entityType):
_showPerson(entityType, user, peopleEntityType, result, j, jcount, FJQC)
Ind.Decrement()

# gam info domaincontacts <PeopleResourceNameEntity>
# [allfields|(fields <PeopleFieldNameList>)] [formatjson]
def doInfoPeopleDomainContacts():
_infoPeople([GC.Values[GC.DOMAIN]], Ent.DOMAIN, 'domaincontact')

# gam info domainprofiles <PeopleResourceNameEntity>
# [allfields|(fields <PeopleFieldNameList>)] [formatjson]
def doInfoPeopleDomainProfiles():
_infoPeople([GC.Values[GC.DOMAIN]], Ent.DOMAIN)
_infoPeople([GC.Values[GC.DOMAIN]], Ent.DOMAIN, 'profile')

# gam <UserTypeEntity> info peoplecontacts <PeopleResourceNameEntity>
# [allfields|(fields <PeopleFieldNameList>)] [formatjson]
def infoPeopleContacts(users):
_infoPeople(users, Ent.USER)
_infoPeople(users, Ent.USER, 'contact')

# gam print domaincontacts [todrive <ToDriveAttribute>*]
# [query <String>]
Expand Down Expand Up @@ -53283,7 +53288,7 @@ def _printVacation(user, result, showDisabled):
Cmd.ARG_DEVICEUSER: doDeleteCIDeviceUser,
Cmd.ARG_DOMAIN: doDeleteDomain,
Cmd.ARG_DOMAINALIAS: doDeleteDomainAlias,
Cmd.ARG_DOMAINPROFILE: doDeletePeopleDomainProfiles,
Cmd.ARG_DOMAINCONTACT: doDeletePeopleDomainContacts,
Cmd.ARG_DRIVEFILEACL: doDeleteDriveFileACLs,
Cmd.ARG_FEATURE: doDeleteFeature,
Cmd.ARG_GROUP: doDeleteGroups,
Expand Down Expand Up @@ -53351,6 +53356,7 @@ def _printVacation(user, result, showDisabled):
Cmd.ARG_DEVICEUSERSTATE: doInfoCIDeviceUserState,
Cmd.ARG_DOMAIN: doInfoDomain,
Cmd.ARG_DOMAINALIAS: doInfoDomainAlias,
Cmd.ARG_DOMAINCONTACT: doInfoPeopleDomainContacts,
Cmd.ARG_DOMAINPROFILE: doInfoPeopleDomainProfiles,
Cmd.ARG_DRIVEFILEACL: doInfoDriveFileACLs,
Cmd.ARG_INSTANCE: doInfoInstance,
Expand Down

0 comments on commit 87d6dd5

Please sign in to comment.