File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed
Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ class UsersCreateCommand extends BoxCommand {
5555 if ( flags [ 'avatar-url' ] ) {
5656 options . avatar_url = flags [ 'avatar-url' ] ;
5757 }
58+ if ( flags [ 'external-id' ] ) {
59+ options . external_app_user_id = flags [ 'external-id' ] ;
60+ }
5861
5962 if ( flags [ 'app-user' ] ) {
6063 user = await this . client . enterprise . addAppUser ( args . name , options ) ;
@@ -74,12 +77,16 @@ UsersCreateCommand.flags = {
7477 'app-user' : flags . boolean ( {
7578 description : 'Set this user as an app user'
7679 } ) ,
80+ 'external-id' : flags . string ( {
81+ description : 'External ID for app users' ,
82+ dependsOn : [ 'app-user' ] ,
83+ } ) ,
7784 'id-only' : flags . boolean ( {
7885 description : 'Return only an ID to output from this command'
7986 } ) ,
8087 'sync-enable' : flags . boolean ( {
8188 description : 'Enable Box Sync for this user' ,
82- exclusion : [ 'sync-disable' ] ,
89+ exclusive : [ 'sync-disable' ] ,
8390 allowNo : true
8491 } ) ,
8592 'exempt-from-device-limits' : flags . boolean ( {
Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ class UsersUpdateCommand extends BoxCommand {
6262 if ( flags . name ) {
6363 updates . name = flags . name ;
6464 }
65+ if ( flags [ 'external-id' ] ) {
66+ updates . external_app_user_id = flags [ 'external-id' ] ;
67+ }
6568
6669 let user = await this . client . users . update ( args . id , updates ) ;
6770 await this . output ( user ) ;
@@ -143,6 +146,9 @@ UsersUpdateCommand.flags = {
143146 timezone : flags . string ( { description : 'The user\'s timezone. Input format follows tz database timezones' } ) ,
144147 'avatar-url' : flags . string ( { description : 'URL of the user\'s avatar image' } ) ,
145148 login : flags . string ( { description : 'Change the user\'s primary email address used for logging into Box ' } ) ,
149+ 'external-id' : flags . string ( {
150+ description : 'External ID for app users' ,
151+ } ) ,
146152} ;
147153
148154UsersUpdateCommand . args = [
Original file line number Diff line number Diff line change @@ -706,18 +706,23 @@ describe('Users', () => {
706706
707707 test
708708 . nock ( TEST_API_ROOT , api => api
709- . post ( '/2.0/users' , { name, is_platform_access_only : true } )
709+ . post ( '/2.0/users' , {
710+ name,
711+ is_platform_access_only : true ,
712+ external_app_user_id : 'foo' ,
713+ } )
710714 . reply ( 201 , fixture )
711715 )
712716 . stdout ( )
713717 . command ( [
714718 'users:create' ,
715719 name ,
716720 '--app-user' ,
721+ '--external-id=foo' ,
717722 '--id-only' ,
718723 '--token=test'
719724 ] )
720- . it ( 'should create a new app user when --app-user flag is passed' , ctx => {
725+ . it ( 'should create a new app user with external ID when App User flags are passed' , ctx => {
721726 assert . equal ( ctx . stdout , `${ JSON . parse ( fixture ) . id } ${ os . EOL } ` ) ;
722727 } ) ;
723728
@@ -863,6 +868,10 @@ describe('Users', () => {
863868 'name flag' : [
864869 '--name=Bob Smith' ,
865870 { name : 'Bob Smith' }
871+ ] ,
872+ 'external ID flag' : [
873+ '--external-id=foo' ,
874+ { external_app_user_id : 'foo' }
866875 ]
867876 } , function ( flag , body ) {
868877
You can’t perform that action at this time.
0 commit comments