Skip to content

Commit 49356f4

Browse files
authored
feat: Support update users notification email (#596)
1 parent 985752b commit 49356f4

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

docs/users.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ USAGE
818818
[--exempt-from-device-limits] [--exempt-from-2fa] [--restrict-external-collab] [--can-see-managed-users]
819819
[--password-reset] [-r user|coadmin] [-l <value>] [-j <value>] [-p <value>] [-a <value>] [-d <value>] [-S
820820
active|inactive|cannot_delete_edit|cannot_delete_edit_upload] [--timezone <value>] [--login <value>] [--external-id
821-
<value>] [--tracking-codes <value>]
821+
<value>] [--tracking-codes <value>] [--notification-email <value>]
822822
823823
ARGUMENTS
824824
ID User ID to update
@@ -853,6 +853,7 @@ FLAGS
853853
--json Output formatted JSON
854854
--login=<value> Change the user's primary email address used for logging into Box
855855
--no-color Turn off colors for logging
856+
--notification-email=<value> Notification email address for the user, set to empty string to remove
856857
--password-reset Force the user to reset password
857858
--remove Remove the user from the enterprise, convert to free account
858859
--[no-]restrict-external-collab Restrict user from external collaboration

src/commands/users/update.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ class UsersUpdateCommand extends BoxCommand {
2626
if (flags.hasOwnProperty('can-see-managed-users')) {
2727
updates.can_see_managed_users = flags['can-see-managed-users'];
2828
}
29+
if (flags.hasOwnProperty('notification-email')) {
30+
if (flags['notification-email'] === '') {
31+
updates.notification_email = null;
32+
} else {
33+
updates.notification_email = { email: flags['notification-email'] };
34+
}
35+
}
2936
if (flags.role) {
3037
updates.role = flags.role;
3138
}
@@ -161,6 +168,9 @@ UsersUpdateCommand.flags = {
161168
};
162169
}),
163170
}),
171+
'notification-email': Flags.string({
172+
description: 'Notification email address for the user, set to empty string to remove',
173+
}),
164174
};
165175

166176
UsersUpdateCommand.args = {

test/commands/users.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,14 @@ describe('Users', () => {
920920
},
921921
],
922922
}
923+
],
924+
'notification email flag': [
925+
926+
{notification_email: {email: '[email protected]'}}
927+
],
928+
'notification email remove flag': [
929+
'--notification-email=',
930+
{notification_email: null}
923931
]
924932
}, function(flag, body) {
925933

0 commit comments

Comments
 (0)