taers232c / GAMADV-XTD3

Command line tool to manage Google Workspace
703 stars 87 forks source link

Copy user information on creation #311

Closed mcipriani-de closed 2 months ago

mcipriani-de commented 1 year ago

Hi, it would be nice to create a user with the ability to copy information and group memberships from an exsisting one. Like the "copyfrom" on group creation. E.g like this gam create user <EmailAddress> copyfrom <EmailAddress>

Regards Michel

taers232c commented 1 year ago

If you have a template user you can do the following:

gam redirect stdout ./template.json info user templateuser@domain.com formatjson
gam create user newuser@domain.com json file ./template.json firstname New lastname User

The following fields are not copied:

USER_JSON_SKIP_FIELDS = ['agreedToTerms', 'aliases', 'creationTime', 'customerId', 'deletionTime', 'groups', 'id',
                         'isAdmin', 'isDelegatedAdmin', 'isEnforcedIn2Sv', 'isEnrolledIn2Sv', 'isMailboxSetup',
                         'lastLoginTime', 'licenses', 'primaryEmail', 'thumbnailPhotoEtag', 'thumbnailPhotoUrl']

I can look into copying the groups.