@@ -92,7 +92,7 @@ async function fetch_bucket_data(action, user_input) {
92
92
let data = {
93
93
// added undefined values to keep the order the properties when printing the data object
94
94
_id : undefined ,
95
- name : _ . isUndefined ( user_input . name ) ? undefined : String ( user_input . name ) ,
95
+ name : user_input . name === undefined ? undefined : String ( user_input . name ) ,
96
96
owner_account : undefined ,
97
97
system_owner : user_input . owner , // GAP - needs to be the system_owner (currently it is the account name)
98
98
bucket_owner : user_input . owner ,
@@ -101,9 +101,9 @@ async function fetch_bucket_data(action, user_input) {
101
101
creation_date : action === ACTIONS . ADD ? new Date ( ) . toISOString ( ) : undefined ,
102
102
path : user_input . path ,
103
103
should_create_underlying_storage : action === ACTIONS . ADD ? false : undefined ,
104
- new_name : _ . isUndefined ( user_input . new_name ) ? undefined : String ( user_input . new_name ) ,
105
- fs_backend : _ . isUndefined ( user_input . fs_backend ) ? config . NSFS_NC_STORAGE_BACKEND : String ( user_input . fs_backend ) ,
106
- force_md5_etag : _ . isUndefined ( user_input . force_md5_etag ) || user_input . force_md5_etag === '' ? user_input . force_md5_etag : get_boolean_or_string_value ( user_input . force_md5_etag )
104
+ new_name : user_input . new_name === undefined ? undefined : String ( user_input . new_name ) ,
105
+ fs_backend : user_input . fs_backend === undefined ? config . NSFS_NC_STORAGE_BACKEND : String ( user_input . fs_backend ) ,
106
+ force_md5_etag : user_input . force_md5_etag === undefined || user_input . force_md5_etag === '' ? user_input . force_md5_etag : get_boolean_or_string_value ( user_input . force_md5_etag )
107
107
} ;
108
108
109
109
if ( user_input . bucket_policy !== undefined ) {
@@ -297,14 +297,14 @@ async function fetch_account_data(action, user_input) {
297
297
let data = {
298
298
// added undefined values to keep the order the properties when printing the data object
299
299
_id : undefined ,
300
- name : _ . isUndefined ( user_input . name ) ? undefined : String ( user_input . name ) ,
301
- email : _ . isUndefined ( user_input . name ) ? undefined : String ( user_input . name ) , // temp, keep the email internally
300
+ name : user_input . name === undefined ? undefined : String ( user_input . name ) ,
301
+ email : user_input . name === undefined ? undefined : String ( user_input . name ) , // temp, keep the email internally
302
302
creation_date : action === ACTIONS . ADD ? new Date ( ) . toISOString ( ) : undefined ,
303
- new_name : _ . isUndefined ( user_input . new_name ) ? undefined : String ( user_input . new_name ) ,
303
+ new_name : user_input . new_name === undefined ? undefined : String ( user_input . new_name ) ,
304
304
new_access_key,
305
305
access_keys,
306
- force_md5_etag : _ . isUndefined ( user_input . force_md5_etag ) || user_input . force_md5_etag === '' ? user_input . force_md5_etag : get_boolean_or_string_value ( user_input . force_md5_etag ) ,
307
- iam_operate_on_root_account : _ . isUndefined ( user_input . iam_operate_on_root_account ) ?
306
+ force_md5_etag : user_input . force_md5_etag === undefined || user_input . force_md5_etag === '' ? user_input . force_md5_etag : get_boolean_or_string_value ( user_input . force_md5_etag ) ,
307
+ iam_operate_on_root_account : user_input . iam_operate_on_root_account === undefined ?
308
308
undefined : get_boolean_or_string_value ( user_input . iam_operate_on_root_account ) ,
309
309
nsfs_account_config : {
310
310
distinguished_name : user_input . user ,
@@ -324,10 +324,10 @@ async function fetch_account_data(action, user_input) {
324
324
// override values
325
325
if ( has_access_keys ( data . access_keys ) ) {
326
326
// access_key as SensitiveString
327
- data . access_keys [ 0 ] . access_key = _ . isUndefined ( data . access_keys [ 0 ] . access_key ) ? undefined :
327
+ data . access_keys [ 0 ] . access_key = data . access_keys [ 0 ] . access_key === undefined ? undefined :
328
328
new SensitiveString ( String ( data . access_keys [ 0 ] . access_key ) ) ;
329
329
// secret_key as SensitiveString
330
- data . access_keys [ 0 ] . secret_key = _ . isUndefined ( data . access_keys [ 0 ] . secret_key ) ? undefined :
330
+ data . access_keys [ 0 ] . secret_key = data . access_keys [ 0 ] . secret_key === undefined ? undefined :
331
331
new SensitiveString ( String ( data . access_keys [ 0 ] . secret_key ) ) ;
332
332
}
333
333
if ( data . new_access_key ) data . new_access_key = new SensitiveString ( data . new_access_key ) ;
@@ -337,8 +337,8 @@ async function fetch_account_data(action, user_input) {
337
337
data . nsfs_account_config . new_buckets_path = data . nsfs_account_config . new_buckets_path || undefined ;
338
338
// force_md5_etag deletion specified with empty string '' checked against user_input.force_md5_etag because data.force_md5_etag is boolean
339
339
data . force_md5_etag = data . force_md5_etag === '' ? undefined : data . force_md5_etag ;
340
- if ( _ . isUndefined ( user_input . allow_bucket_creation ) ) {
341
- data . allow_bucket_creation = ! _ . isUndefined ( data . nsfs_account_config . new_buckets_path ) ;
340
+ if ( user_input . allow_bucket_creation === undefined ) {
341
+ data . allow_bucket_creation = data . nsfs_account_config . new_buckets_path !== undefined ;
342
342
} else if ( typeof user_input . allow_bucket_creation === 'boolean' ) {
343
343
data . allow_bucket_creation = Boolean ( user_input . allow_bucket_creation ) ;
344
344
} else { // string of true or false
@@ -358,7 +358,7 @@ async function fetch_existing_account_data(action, target, decrypt_secret_key) {
358
358
} catch ( err ) {
359
359
dbg . log1 ( 'NSFS Manage command: Could not find account' , target , err ) ;
360
360
if ( err . code === 'ENOENT' ) {
361
- if ( _ . isUndefined ( target . name ) ) {
361
+ if ( target . name === undefined ) {
362
362
throw_cli_error ( ManageCLIError . NoSuchAccountAccessKey , target . access_keys [ 0 ] . access_key ) ;
363
363
} else {
364
364
throw_cli_error ( ManageCLIError . NoSuchAccountName , target . name ) ;
@@ -368,9 +368,9 @@ async function fetch_existing_account_data(action, target, decrypt_secret_key) {
368
368
}
369
369
const data = _ . merge ( { } , source , target ) ;
370
370
if ( action === ACTIONS . UPDATE ) {
371
- const uid_update = ! _ . isUndefined ( target . nsfs_account_config . uid ) ;
372
- const gid_update = ! _ . isUndefined ( target . nsfs_account_config . gid ) ;
373
- const dn_update = ! _ . isUndefined ( target . nsfs_account_config . distinguished_name ) ;
371
+ const uid_update = target . nsfs_account_config . uid !== undefined ;
372
+ const gid_update = target . nsfs_account_config . gid !== undefined ;
373
+ const dn_update = target . nsfs_account_config . distinguished_name !== undefined ;
374
374
const user_fs_permissions_change = uid_update || gid_update || dn_update ;
375
375
if ( user_fs_permissions_change ) {
376
376
if ( dn_update ) {
@@ -486,13 +486,13 @@ async function get_account_status(data, show_secrets) {
486
486
const options = { show_secrets, decrypt_secret_key : show_secrets } ;
487
487
488
488
try {
489
- const config_data = _ . isUndefined ( data . name ) ?
489
+ const config_data = data . name === undefined ?
490
490
await config_fs . get_account_by_access_key ( data . access_keys [ 0 ] . access_key , options ) :
491
491
await config_fs . get_account_by_name ( data . name , options ) ;
492
492
write_stdout_response ( ManageCLIResponse . AccountStatus , config_data ) ;
493
493
} catch ( err ) {
494
494
if ( err . code !== 'ENOENT' ) throw err ;
495
- if ( _ . isUndefined ( data . name ) ) {
495
+ if ( data . name === undefined ) {
496
496
throw_cli_error ( ManageCLIError . NoSuchAccountAccessKey , data . access_keys [ 0 ] . access_key . unwrap ( ) ) ;
497
497
} else {
498
498
throw_cli_error ( ManageCLIError . NoSuchAccountName , data . name ) ;
0 commit comments