From 4e0ae154a5367120553b277a8798662873c2d10f Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Fri, 28 Jun 2024 16:55:10 -0700 Subject: [PATCH] Quote tildes in gam csv command lines --- docs/Bulk-Processing.md | 16 ++++++------- docs/Chrome-Browser-Cloud-Management.md | 2 +- docs/ChromeOS-Devices.md | 4 ++-- docs/Classroom-Invitations.md | 2 +- docs/Cloud-Identity-Groups-Membership.md | 4 ++-- docs/Command-Logging-Progress.md | 4 ++-- docs/Groups-Membership.md | 4 ++-- docs/Groups.md | 2 +- docs/Meta-Commands-and-File-Redirection.md | 20 ++++++++--------- docs/Todrive.md | 6 ++--- docs/Users-Drive-Files-Display.md | 6 ++--- docs/Users-Drive-Files-Manage.md | 4 ++-- docs/Users-Gmail-Forwarding.md | 5 +++++ docs/Users-Group-Membership.md | 6 ++--- docs/Users-Spreadsheets.md | 2 +- docs/Users.md | 26 +++++++++++----------- docs/gam.cfg.md | 24 ++++++++++---------- 17 files changed, 71 insertions(+), 66 deletions(-) diff --git a/docs/Bulk-Processing.md b/docs/Bulk-Processing.md index 9de9185e..edadd4c5 100644 --- a/docs/Bulk-Processing.md +++ b/docs/Bulk-Processing.md @@ -58,7 +58,7 @@ Tbatch files can also contain the following line: * You have a CSV file NewStudents.csv with columns: Email,First,Last,GradYear,Password * You have a batch file NewStudents.bat containing these commands: ``` -gam csv NewStudents.csv gam create user ~Email firstname ~First lastname ~Last org "/Students/~~GradYear~~" password ~Password +gam csv NewStudents.csv gam create user "~Email" firstname "~First" lastname "~Last" org "/Students/~~GradYear~~" password "~Password" commit-batch gam update group seniors sync members ou /Students/2020 gam update group juniors sync members ou /Students/2021 @@ -121,7 +121,7 @@ Put a space in front of the `~`: `targetfolder " ~/Documents/GamWork"` to avoid * You want a note field that shows their email address as name AT domain.com * You have a CSV file Users.csv with columns: primaryEmail,Street,City,State,ZIP ``` -gam csv Users.csv gam update user ~primaryEmail address type work unstructured "~~Street~~, ~~City~~, ~~State~~ ~~ZIP~~" primary note text_plain "~~primaryEmail~!~^(.+)@(.+)$~!~\1 AT \2~~" +gam csv Users.csv gam update user "~primaryEmail" address type work unstructured "~~Street~~, ~~City~~, ~~State~~ ~~ZIP~~" primary note text_plain "~~primaryEmail~!~^(.+)@(.+)$~!~\1 AT \2~~" ``` * You want to do the above using a Google Sheet ``` @@ -131,17 +131,17 @@ gam csv gsheet "" gam update user "~primaryEmail" add ## CSV files with redirection and select You should use the `multiprocess` option on any redirected files: `csv`, `stdout`, `stderr`. ``` -gam redirect csv ./filelistperms.csv multiprocess csv Users.csv gam user ~primaryEmail print filelist fields id,name,mimetype,basicpermissions -gam redirect csv - multiprocess todrive csv Users.csv gam user ~primaryEmail print filelist fields id,name,mimetype,basicpermissions +gam redirect csv ./filelistperms.csv multiprocess csv Users.csv gam user "~primaryEmail" print filelist fields id,name,mimetype,basicpermissions +gam redirect csv - multiprocess todrive csv Users.csv gam user "~primaryEmail" print filelist fields id,name,mimetype,basicpermissions ``` If you want to select a `gam.cfg` section for the command, you can select the section at the outer `gam` and save it or select the section at the inner `gam`. ``` -gam select
save redirect csv ./filelistperms.csv multiprocess csv Users.csv gam user ~primaryEmail print filelist fields id,name,mimetype,basicpermissions -gam redirect csv ./filelistperms.csv multiprocess csv Users.csv gam select
user ~primaryEmail print filelist fields id,name,mimetype,basicpermissions -gam select
save redirect csv - multiprocess todrive csv Users.csv gam user ~primaryEmail print filelist fields id,name,mimetype,basicpermissions -gam redirect csv - multiprocess todrive csv Users.csv gam select
user ~primaryEmail print filelist fields id,name,mimetype,basicpermissions +gam select
save redirect csv ./filelistperms.csv multiprocess csv Users.csv gam user "~primaryEmail" print filelist fields id,name,mimetype,basicpermissions +gam redirect csv ./filelistperms.csv multiprocess csv Users.csv gam select
user "~primaryEmail" print filelist fields id,name,mimetype,basicpermissions +gam select
save redirect csv - multiprocess todrive csv Users.csv gam user "~primaryEmail" print filelist fields id,name,mimetype,basicpermissions +gam redirect csv - multiprocess todrive csv Users.csv gam select
user "~primaryEmail" print filelist fields id,name,mimetype,basicpermissions ``` ## Automatic batch processing diff --git a/docs/Chrome-Browser-Cloud-Management.md b/docs/Chrome-Browser-Cloud-Management.md index 78b4350a..f9dabb11 100644 --- a/docs/Chrome-Browser-Cloud-Management.md +++ b/docs/Chrome-Browser-Cloud-Management.md @@ -130,7 +130,7 @@ If you have a CSV file, UpdateBrowsers.csv with two columns: deviceId,notes this command will add a new line of notes to the front of the existing notes: ``` -gam csv UpdateBrowsers.csv gam update browser ~deviceId updatenotes "~~notes~~\n#notes#" +gam csv UpdateBrowsers.csv gam update browser "~deviceId" updatenotes "~~notes~~\n#notes#" ``` ## Move Chrome browsers from one OU to another diff --git a/docs/ChromeOS-Devices.md b/docs/ChromeOS-Devices.md index d0111462..dc3f7868 100644 --- a/docs/ChromeOS-Devices.md +++ b/docs/ChromeOS-Devices.md @@ -364,7 +364,7 @@ If you have a CSV file, UpdateCrOS.csv with two columns: deviceId,notes this command will add a new line of notes to the front of the existing notes: ``` -gam csv UpdateCrOS.csv gam update cros ~deviceId updatenotes "~~notes~~\n#notes#" +gam csv UpdateCrOS.csv gam update cros "~deviceId" updatenotes "~~notes~~\n#notes#" ``` ## Add ChromeOS devices to an organizational unit @@ -856,7 +856,7 @@ gam redirect stdout ./CrOSDeviceFiles.out redirect stderr stdout csvkmd cros ./C Download the device files in parallel. ``` -gam redirect stdout ./CrOSDeviceFiles.out multiprocess redirect stderr stdout csv ./CrOSDeviceFiles.csv matchfield deviceFiles.type LOG_FILE gam cros ~deviceId get devicefile select ~deviceFiles.createTime +gam redirect stdout ./CrOSDeviceFiles.out multiprocess redirect stderr stdout csv ./CrOSDeviceFiles.csv matchfield deviceFiles.type LOG_FILE gam cros "~deviceId" get devicefile select "~deviceFiles".createTime ``` Suppose you want only the last device file for each Chromebook. diff --git a/docs/Classroom-Invitations.md b/docs/Classroom-Invitations.md index 8df313c8..0365bbed 100644 --- a/docs/Classroom-Invitations.md +++ b/docs/Classroom-Invitations.md @@ -69,7 +69,7 @@ gam redirect stdout ./Invites.out redirect stderr stdout csvkmd users CourseStud ``` This command will invite all students to their courses in parallel ``` -gam redirect stdout ./Invites.out multiprocess redirect stderr stdout multiprocess csv CourseStudent.csv gam user ~Student create classroominvitation role student course ~Course +gam redirect stdout ./Invites.out multiprocess redirect stderr stdout multiprocess csv CourseStudent.csv gam user "~Student" create classroominvitation role student course "~Course" ``` ## Accept classroom invitations by user Accept classroom invitations for users. diff --git a/docs/Cloud-Identity-Groups-Membership.md b/docs/Cloud-Identity-Groups-Membership.md index e28c77dd..96dcfced 100644 --- a/docs/Cloud-Identity-Groups-Membership.md +++ b/docs/Cloud-Identity-Groups-Membership.md @@ -237,10 +237,10 @@ seniors@domain.org,/Students/ClassOf2018 juniors@domain.org,/Students/ClassOf2019 ... ``` -This allows you to do: `gam csv GradeOU.csv gam update cigroup ~Grade sync members ou ~OU` +This allows you to do: `gam csv GradeOU.csv gam update cigroup "~Grade" sync members ou "~OU"` But suppose that at each grade level there are additional group members that are groups of faculty/staff; e.g., senioradvisors@domain.org. In this scenario, you can't do the `update cigroup sync` command as the members that are groups will be deleted; the `usersonly` option allows -the `update cigroup sync` command to work: `gam csv GradeOU.csv gam update cigroup ~Grade sync members usersonly ou ~OU` +the `update cigroup sync` command to work: `gam csv GradeOU.csv gam update cigroup "~Grade" sync members usersonly ou "~OU"` The users from the OU are matched against the user members of the group and adds/deletes are done as necessary to synchronize them; the group members of the group are unaffected. diff --git a/docs/Command-Logging-Progress.md b/docs/Command-Logging-Progress.md index cfe6580d..939fb5ab 100644 --- a/docs/Command-Logging-Progress.md +++ b/docs/Command-Logging-Progress.md @@ -44,14 +44,14 @@ the sub-command lines and the initial command with a numeric return code. $ gam redirect stdout usernames.csv multiprocess redirect stderr stdout csv users.csv gam info user "~primaryEmail" quick name 2021-08-01T19:50:38.151-07:00,0/6,Using 6 processes... $ more ~/.gam/gam.log -2021-08-01T19:50:38.120-07:00,*,/Users/admin/bin/gamadv-xtd3/gam redirect stdout usernames.csv multiprocess redirect stderr stdout csv users.csv showcmds false gam info user ~primaryEmail quick name +2021-08-01T19:50:38.120-07:00,*,/Users/admin/bin/gamadv-xtd3/gam redirect stdout usernames.csv multiprocess redirect stderr stdout csv users.csv showcmds false gam info user "~primaryEmail" quick name 2021-08-01T19:50:39.144-07:00,0,gam info user testuser2 quick name 2021-08-01T19:50:39.358-07:00,0,gam info user testuser3 quick name 2021-08-01T19:50:39.358-07:00,0,gam info user testuser1 quick name 2021-08-01T19:50:39.401-07:00,0,gam info user testuser5 quick name 2021-08-01T19:50:39.459-07:00,56,gam info user testuserx quick name 2021-08-01T19:50:39.470-07:00,0,gam info user testuser4 quick name -2021-08-01T19:50:39.483-07:00,0,/Users/admin/bin/gamadv-xtd3/gam redirect stdout usernames.csv multiprocess redirect stderr stdout csv users.csv showcmds false gam info user ~primaryEmail quick name +2021-08-01T19:50:39.483-07:00,0,/Users/admin/bin/gamadv-xtd3/gam redirect stdout usernames.csv multiprocess redirect stderr stdout csv users.csv showcmds false gam info user "~primaryEmail" quick name ``` ## Command Progress diff --git a/docs/Groups-Membership.md b/docs/Groups-Membership.md index 877b91ae..9c19e135 100644 --- a/docs/Groups-Membership.md +++ b/docs/Groups-Membership.md @@ -305,10 +305,10 @@ seniors@domain.org,/Students/ClassOf2023 juniors@domain.org,/Students/ClassOf2024 ... ``` -This allows you to do: `gam csv GradeOU.csv gam update group ~Grade sync members ou ~OU` +This allows you to do: `gam csv GradeOU.csv gam update group "~Grade" sync members ou "~OU"` But suppose that at each grade level there are additional group members that are groups of faculty/staff; e.g., senioradvisors@domain.org. In this scenario, you can't do the `update group sync` command as the members that are groups will be deleted; the `usersonly` option allows -the `update group sync` command to work: `gam csv GradeOU.csv gam update group ~Grade sync members usersonly ou ~OU` +the `update group sync` command to work: `gam csv GradeOU.csv gam update group "~Grade" sync members usersonly ou "~OU"` The users from the OU are matched against the user members of the group and adds/deletes are done as necessary to synchronize them; the group members of the group are unaffected. diff --git a/docs/Groups.md b/docs/Groups.md index 36b1d6c0..36475e55 100644 --- a/docs/Groups.md +++ b/docs/Groups.md @@ -384,7 +384,7 @@ Getting Group Settings for testgroup4@domain.com (4/4) ``` Perform your experiments and then restore the original settings. ``` -$ gam csv ./groups.csv quotechar "'" gam update group ~email json ~JSON-settings +$ gam csv ./groups.csv quotechar "'" gam update group "~email" json "~JSON-settings" Using 4 processes... Group: testgroup1@domain.com, Updated Group: testgroup2@domain.com, Updated diff --git a/docs/Meta-Commands-and-File-Redirection.md b/docs/Meta-Commands-and-File-Redirection.md index 7c7a5896..8e571bc1 100644 --- a/docs/Meta-Commands-and-File-Redirection.md +++ b/docs/Meta-Commands-and-File-Redirection.md @@ -171,9 +171,9 @@ If the pattern `{{Section}}` appears in ``, it will be replaced with t ### Examples - redirect CSV Suppose that you have a CSV file CourseList.csv with a column labeled CourseId that contains course Ids. You want a single CSV file with participant information for these courses. ``` -gam redirect csv ./CourseInfo.csv multiprocess csv CourseList.csv gam print course-participants course ~CourseId +gam redirect csv ./CourseInfo.csv multiprocess csv CourseList.csv gam print course-participants course "~CourseId" ``` -`redirect csv ./CourseInfo.csv multiprocess` causes gam to collect output from all of the processes started by `csv CourseList.csv gam print course-participants course ~CourseId` and produces a single CSV file CourseInfo.csv. +`redirect csv ./CourseInfo.csv multiprocess` causes gam to collect output from all of the processes started by `csv CourseList.csv gam print course-participants course "~CourseId"` and produces a single CSV file CourseInfo.csv. Generate a list of CrOS devices and update an existing sheet in a Google spreadsheet. The file ID and sheet IDs are preserved so other appplications can access the data using the file ID and sheet ID. By setting 'tdtimestamp true`, the file name will the updated to reflect the time of execution, but the file ID will not change. @@ -183,23 +183,23 @@ gam redirect csv - todrive tdtitle "CrOS" tdtimestamp true tdfileid 12345-mizZ6Q For a collection of users, generate a list of files shared with anyone; combine the output for all users into a single file. ``` -gam redirect csv - multiprocess todrive tdtitle AnyoneShares-All csv Users.csv gam user ~primaryEmail print filelist fields id,name,permissions pm type anyone em +gam redirect csv - multiprocess todrive tdtitle AnyoneShares-All csv Users.csv gam user "~primaryEmail" print filelist fields id,name,permissions pm type anyone em ``` For a collection of users, generate a list of files shared with anyone; generate a separate file for each user. The two forms of the command are equivalent. ``` -gam csv Users.csv gam redirect csv - todrive tdtitle "AnyoneShares-~~primaryEmail~~" user ~primaryEmail print filelist fields id,name,permissions pm type anyone em +gam csv Users.csv gam redirect csv - todrive tdtitle "AnyoneShares-~~primaryEmail~~" user "~primaryEmail" print filelist fields id,name,permissions pm type anyone em -gam csv Users.csv gam user ~primaryEmail print filelist fields id,name,permissions pm type anyone em todrive tdtitle "AnyoneShares-~~primaryEmail~~" +gam csv Users.csv gam user "~primaryEmail" print filelist fields id,name,permissions pm type anyone em todrive tdtitle "AnyoneShares-~~primaryEmail~~" ``` ### Examples - Redirect stdout -The output from each of the `gam info user ~primaryEmail` commands will be combined into the single file Users.txt. +The output from each of the `gam info user "~primaryEmail"` commands will be combined into the single file Users.txt. The value of `show_multiprocess_info` from `gam.cfg` controls whether information identifying the processes is also shown. ``` -$ gam config show_multiprocess_info false redirect stdout ./Users.txt multiprocess csv Users.csv gam info user ~primaryEmail +$ gam config show_multiprocess_info false redirect stdout ./Users.txt multiprocess csv Users.csv gam info user "~primaryEmail" $ more Users.txt User: testuser1@domain.com (1/1) Settings: @@ -214,9 +214,9 @@ User: testuser2@domain.com@ (1/1) Full Name: Test User2 ... -$ gam config show_multiprocess_info true redirect stdout ./Users.txt multiprocess csv Users.csv gam info user ~primaryEmail +$ gam config show_multiprocess_info true redirect stdout ./Users.txt multiprocess csv Users.csv gam info user "~primaryEmail" $ more Users.txt -stdout: 0, Start: 2017-01-26T11:35:00.897773-08:00, RC: 0, Cmd: /Users/admin/gam config show_multiprocess_info true redirect stdout ./Users.txt multiprocess csv Users.csv gam info user ~primaryEmail +stdout: 0, Start: 2017-01-26T11:35:00.897773-08:00, RC: 0, Cmd: /Users/admin/gam config show_multiprocess_info true redirect stdout ./Users.txt multiprocess csv Users.csv gam info user "~primaryEmail" stdout: 1, Start: 2017-01-26T11:35:00.902709-08:00, RC: 0, Cmd: gam info user testuser1@domain.com User: testuser1@domain.com (1/1) Settings: @@ -233,5 +233,5 @@ User: testuser2@domain.com@ (1/1) Full Name: Test User2 ... stdout: 2, End: 2017-01-26T11:35:02.849646-08:00, RC: 0, Cmd: gam info user testuser2@domain.com -stdout: 0, End: 2017-01-26T11:35:02.907141-08:00, RC: 0, Cmd: /Users/admin/gam config show_multiprocess_info true redirect stdout ./Users.txt multiprocess csv Users.csv gam info user ~primaryEmail +stdout: 0, End: 2017-01-26T11:35:02.907141-08:00, RC: 0, Cmd: /Users/admin/gam config show_multiprocess_info true redirect stdout ./Users.txt multiprocess csv Users.csv gam info user "~primaryEmail" ``` diff --git a/docs/Todrive.md b/docs/Todrive.md index ccb9b0d7..eb4e3d67 100644 --- a/docs/Todrive.md +++ b/docs/Todrive.md @@ -304,15 +304,15 @@ gam redirect csv - todrive tdtitle "CrOS" tdtimestamp true tdfileid 12345-mizZ6Q For a collection of users, generate a list of files shared with anyone; combine the output for all users into a single file. ``` -gam redirect csv - multiprocess todrive tdtitle AnyoneShares-All csv Users.csv gam user ~primaryEmail print filelist fields id,name,permissions pm type anyone em +gam redirect csv - multiprocess todrive tdtitle AnyoneShares-All csv Users.csv gam user "~primaryEmail" print filelist fields id,name,permissions pm type anyone em ``` For a collection of users, generate a list of files shared with anyone; generate a separate file for each user. The two forms of the command are equivalent. ``` -gam csv Users.csv gam redirect csv - todrive tdtitle "AnyoneShares-~~primaryEmail~~" user ~primaryEmail print filelist fields id,name,permissions pm type anyone em +gam csv Users.csv gam redirect csv - todrive tdtitle "AnyoneShares-~~primaryEmail~~" user "~primaryEmail" print filelist fields id,name,permissions pm type anyone em -gam csv Users.csv gam user ~primaryEmail print filelist fields id,name,permissions pm type anyone em todrive tdtitle "AnyoneShares-~~primaryEmail~~" +gam csv Users.csv gam user "~primaryEmail" print filelist fields id,name,permissions pm type anyone em todrive tdtitle "AnyoneShares-~~primaryEmail~~" ``` Suppose you have a spreadsheet with sheets `Monday` ... `Friday`, `Backup Monday` ... `Backup Friday` and `Latest`. diff --git a/docs/Users-Drive-Files-Display.md b/docs/Users-Drive-Files-Display.md index c307a8de..f3af9bfb 100644 --- a/docs/Users-Drive-Files-Display.md +++ b/docs/Users-Drive-Files-Display.md @@ -1501,8 +1501,8 @@ Getting all Drive Files/Folders that match query ('me' in owners and name contai Got 0 Drive Files/Folders that matched query ('me' in owners and name contains 'abcd') for user@domain.com... $ more Files.csv Owner -$ gam csv Files.csv gam user ~Owner show fileinfo ~id permissions -Command: /Users/admin/bin/gam csv Files.csv gam user ~Owner show fileinfo >>>~id<<< permissions +$ gam csv Files.csv gam user "~Owner" show fileinfo "~id" permissions +Command: /Users/admin/bin/gam csv Files.csv gam user "~Owner" show fileinfo >>>~id<<< permissions ERROR: Header "id" not found in CSV headers of "Owner". Help: Syntax in file /Users/admin/bin/gam/GamCommands.txt @@ -1516,7 +1516,7 @@ Getting all Drive Files/Folders that match query ('me' in owners and name contai Got 0 Drive Files/Folders that matched query ('me' in owners and name contains 'abcd') for user@domain.com... $ more Files.csv Owner,id,name -$ gam csv Files.csv gam user ~Owner show fileinfo ~id permissions +$ gam csv Files.csv gam user "~Owner" show fileinfo "~id" permissions $ ``` diff --git a/docs/Users-Drive-Files-Manage.md b/docs/Users-Drive-Files-Manage.md index a9820c50..5027a7fd 100644 --- a/docs/Users-Drive-Files-Manage.md +++ b/docs/Users-Drive-Files-Manage.md @@ -284,7 +284,7 @@ mary@domain.com, Mary Smith # Create the student folders on the Shared Drive gam redirect csv ./StudentFolders.csv multiprocess csv Students.csv gam user admin@domain.com create drivefile mimetype gfolder drivefilename "~~Name~~ Digital Portfolio" parentid csv addcsvdata primaryEmail "~primaryEmail" -# Add ACLs granting the students write access to their folders; ~User refers to admin@domain.com +# Add ACLs granting the students write access to their folders; "~User" refers to admin@domain.com gam csv StudentFolders.csv gam user "~User" add drivefileacl "~id" user "~primaryEmail" role fileorganizer # Add a shortcut to the folder on the student's My Drive gam csv StudentFolders.csv gam user "~primaryEmail" create drivefileshortcut "~id" parentid root @@ -618,7 +618,7 @@ Suppose you have a Google Sheets file UserSheet with multiple sheets, one of whi The following command will download the sheet and show the name for each user in the column. ``` -gam user user@domain.com get drivefile drivefilename UserSheet csvsheet NewUsers targetname - | gam redirect stdout - multiprocess csv - gam info user ~primaryEmail name nogroups nolicenses +gam user user@domain.com get drivefile drivefilename UserSheet csvsheet NewUsers targetname - | gam redirect stdout - multiprocess csv - gam info user "~primaryEmail" name nogroups nolicenses ``` * The `redirect stdout - multiprocess` option produces clean output from the multiple processes diff --git a/docs/Users-Gmail-Forwarding.md b/docs/Users-Gmail-Forwarding.md index 94bc0bc2..de58a86d 100644 --- a/docs/Users-Gmail-Forwarding.md +++ b/docs/Users-Gmail-Forwarding.md @@ -87,3 +87,8 @@ Show forwarding addresses for all users with forwarding on. gam config auto_batch_min 1 num_threads 5 redirect csv ./FowardEnabledUsers.csv multiprocess redirect stdout - multiprocess redirect stderr stdout all users print forward enabledonly gam redirect csv ./FowardEnabledUsersForwardingAddresses.csv multiprocess redirect stdout - multiprocess redirect stderr stdout csv ./FowardEnabledUsers.csv gam user "~User" print forwardingaddresses ``` + +Show forwarding addresses that are not your domain for all users with forwarding on. +``` +gam config csv_output_row_drop_filter "forwardTo:regex:yourdomain.com" auto_batch_min 1 num_threads 20 redirect csv ./NonDomainForwards.csv multiprocess redirect stdout - multiprocess redirect stderr stdout all users print forward enabledonly +``` \ No newline at end of file diff --git a/docs/Users-Group-Membership.md b/docs/Users-Group-Membership.md index ce149761..d1b114ef 100644 --- a/docs/Users-Group-Membership.md +++ b/docs/Users-Group-Membership.md @@ -81,7 +81,7 @@ $ gam csvkmd users UserGroupRole.csv keyfield User print groups User,Group,Role,Status,Delivery # Add users to groups -$ gam redirect stdout - multiprocess csv UserGroupRole.csv gam user ~User add group ~Role ~Delivery ~Group +$ gam redirect stdout - multiprocess csv UserGroupRole.csv gam user "~User" add group "~Role" "~Delivery" "~Group" Using 5 processes... User: testuser1@domain.com, Add to 1 Group Group: testgroup1@domain.com, Owner: testuser1@domain.com, Added @@ -249,7 +249,7 @@ testuser2@domain.com,testgroup2@domain.com,MANAGER,ACTIVE,DAILY testuser3@domain.com,testgroup2@domain.com,OWNER,ACTIVE,DIGEST # Update roles/delivery settings -$ gam redirect stdout - multiprocess csv UserGroupRoleNew.csv gam user ~User update group ~Role ~Delivery ~Group +$ gam redirect stdout - multiprocess csv UserGroupRoleNew.csv gam user "~User" update group "~Role" "~Delivery" "~Group" Using 3 processes... User: testuser2@domain.com, Update to 1 Group Group: testgroup2@domain.com, Manager: testuser2@domain.com, Updated @@ -357,7 +357,7 @@ testuser3@domain.com,testgroup1@domain.com,MEMBER,ACTIVE,ALL_MAIL testuser3@domain.com,testgroup2@domain.com,OWNER,ACTIVE,ALL_MAIL # Update roles/delivery settings -$ gam redirect stdout - multiprocess csv UserGroupRole.csv gam user ~User update group ~Role ~Delivery ~Group +$ gam redirect stdout - multiprocess csv UserGroupRole.csv gam user "~User" update group "~Role" "~Delivery" "~Group" Using 5 processes... User: testuser2@domain.com, Update to 1 Group Group: testgroup1@domain.com, Member: testuser2@domain.com, Updated diff --git a/docs/Users-Spreadsheets.md b/docs/Users-Spreadsheets.md index bcca830b..d65c658d 100644 --- a/docs/Users-Spreadsheets.md +++ b/docs/Users-Spreadsheets.md @@ -133,7 +133,7 @@ CSV file Sheet.csv contains: User,spreadsheetId,JSON user@domain.com,1MOq6umgWSM7NF8-CQ-Aj3_n1DIu_GvyCcuLxxxxxx,'[{"range": "Sheet1!A1:C1", "values": [["1", "2", "3"]], "majorDimension": "ROWS"}, {"range": "Sheet1!A3:C3", "values": [["10/01/2017 10:30:00", true, "6"]], "majorDimension": "ROWS"}]' -gam csv Sheet.csv quotechar "'" gam user ~User update sheetranges ~spreadsheetId json ~JSON userentered includevaluesinresponse +gam csv Sheet.csv quotechar "'" gam user "~User" update sheetranges "~spreadsheetId" json "~JSON" userentered includevaluesinresponse ``` ## Create spreadsheets ``` diff --git a/docs/Users.md b/docs/Users.md index f3924d02..d7473d8c 100644 --- a/docs/Users.md +++ b/docs/Users.md @@ -239,7 +239,7 @@ queries "`"orgUnitPath=\'/Students/Lower\ School/2027\'`",`"orgUnitPath=\'/Stude protocol aim|gtalk|icq|jabber|msn|net_meeting|qq| skype|yahoo|(custom_protocol ) notprimary|primary)| - (keyword mission|occupation|outlook|(custom ) )| + (keyword mission|occupation|outlook|(custom ) )| (location [type default|desk|] area [building|buildingid ] [floor|floorname ] [section|floorsection ] [desk|deskcode ] endlocation)| @@ -250,7 +250,7 @@ queries "`"orgUnitPath=\'/Students/Lower\ School/2027\'`",`"orgUnitPath=\'/Stude [description ] [domain ] [fulltimeequivalent ] notprimary|primary)| - (otheremail home|other|work| )| + (otheremail home|other|work|(custom )| )| (phone [type assistant|callback|car|company_main|grand_central|home| home_fax|isdn|main|mobile|other|other_fax|pager|radio|telex|tty_tdd| work|work_fax|work_mobile|work_pager|(custom )] @@ -262,10 +262,10 @@ queries "`"orgUnitPath=\'/Students/Lower\ School/2027\'`",`"orgUnitPath=\'/Stude [primary ] endposix)| (relation admin_assistant|assistant|brother|child|domestic_partner| dotted-line_manager|exec_assistant|father|friend|manager|mother| - parent|partner|referred_by|relative|sister|spouse| )| + parent|partner|referred_by|relative|sister|spouse|(custom )| )| (sshkeys key [expires ] endssh)| (website app_install_page|blog|ftp|home|home_page|other| - profile|reservations|resume|work| + profile|reservations|resume|work|(custom )| notprimary|primary) ::= @@ -464,7 +464,7 @@ If you specify `scalarnonempty`, empty values will be suppressed. This is most u For example, to suppress errors when empty values would cause an error or are simply undesirable: ``` -GeoData.Region scalarnonempty ~region GeoData.State scalarnonempty ~state GeoData.City scalarnonempty ~city +GeoData.Region scalarnonempty "~region" GeoData.State scalarnonempty "~state" GeoData.City scalarnonempty "~city" ``` ### Multivalued fields ``` @@ -541,7 +541,7 @@ When creating a user, you can send a message with the account details to an emai If you create a user with `random password`, the `lograndompassword ` option causes GAM to append the user email address and random password to ``. If `` is `-`, the data is written to stdout. -Option `ignorenullpassword` causes GAM to ignore options like `password ""` or `password ~password` where the +Option `ignorenullpassword` causes GAM to ignore options like `password ""` or `password "~password"` where the CSV entry `password` is null; it must appear in the command before any null passwords. If `ignorenullpassword` and a null password are entered, the user will be assigned a random password. @@ -570,8 +570,8 @@ OU needs to be already set with forced 2FA, else you can't create backup codes i These three commands should be run in sequence, as commands two and three are reliant on the previous command being run. ``` gam redirect stdout CreateUsers.log multiprocess redirect stderr stdout csv CreateUsers.csv gam create user "~useremail" firstname "~firstname" lastname "~lastname" ou "~ou" password random notify "~~notifyemail" -gam redirect stdout UpdateUsers.log multiprocess redirect stderr stdout csv CreateUsers.csv gam user ~useremail update backupcodes -gam redirect stdout SendBackupCodes.log multiprocess redirect stderr stdout csv CreateUsers.csv gam user ~useremail print backupcodes | gam csv - gam sendemail "~notifyemail" subject "Backup codes for 2FA login" message "~verificationCodes" +gam redirect stdout UpdateUsers.log multiprocess redirect stderr stdout csv CreateUsers.csv gam user "~useremail" update backupcodes +gam redirect stdout SendBackupCodes.log multiprocess redirect stderr stdout csv CreateUsers.csv gam user "~useremail" print backupcodes | gam csv - gam sendemail "~notifyemail" subject "Backup codes for 2FA login" message "~verificationCodes" ``` ## Specify a user's attributes with JSON data @@ -713,19 +713,19 @@ The user aliases in `alias|aliases ` will be created. For example, you are given a CSV file Users.csv with these headers: email,firstname,lastname,password,ou,altemail ``` -gam csv Users.csv gam update user ~email firstname ~firstname lastname ~lastname password ~password ou ~ou createifnotfound notify ~altemail +gam csv Users.csv gam update user "~email" firstname "~firstname" lastname "~lastname" password "~password" ou "~ou" createifnotfound notify "~altemail" ``` The existing users (including their passwords) will be updated and the new users will be created; if `notify` is specified, a notification email message is sent as in (#create-a-user). If you don't want to update the passwords of the existing users but must supply a password for newly created users, use the `notfoundpassword` option. ``` -gam csv Users.csv gam update user ~email firstname ~firstname lastname ~lastname notfoundpassword ~password ou ~ou createifnotfound notify ~altemail +gam csv Users.csv gam update user "~email" firstname "~firstname" lastname "~lastname" notfoundpassword "~password" ou "~ou" createifnotfound notify "~altemail" ``` The existing users (but not their passwords) will be updated and the new users will be created; if `notify` is specified, a notification email message is sent as in (#create-a-user). If you don't want to force a password change of the existing users but do want newly created users to change their password, use the `setchangepasswordoncreate` option. ``` -gam csv Users.csv gam update user ~email firstname ~firstname lastname ~lastname notfoundpassword ~password ou ~ou createifnotfound notify ~altemail setchangepasswordoncreate true +gam csv Users.csv gam update user "~email" firstname "~firstname" lastname "~lastname" notfoundpassword "~password" ou "~ou" createifnotfound notify "~altemail" setchangepasswordoncreate true ``` ## Update a user's name @@ -742,7 +742,7 @@ assigned a unique random password, specify `password uniquerandom`. If you update a user with `password random|uniquerandom`, the `lograndompassword ` option causes GAM to append the user email address and random password to ``. If `