phoseum-cli 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfc9c3e5f01d6ea982796a580be0195b76156127ab1b39c3c1bfdb0d1ada4f21
4
- data.tar.gz: eb9e11b414ee5be39678593668f2fa8f02477e61b1cdbd85a0d69fbdf8728d6f
3
+ metadata.gz: 3e2bd25792289a6beebdf3d17cb4b4365086d407348c4ca7e17862b65522f57d
4
+ data.tar.gz: f4fbfa8dc826cfb429b15b3ccbc79446af45d6a44dbd99e01ce96ee77dfa15b6
5
5
  SHA512:
6
- metadata.gz: c433b128e7140e01364e04309bec935cf66efcfebe785ffbe7f4cefbf0dcdf007cb2f8f7f6398eb7fcae87c751fb7f4213110422b03d621120c991369277d8a6
7
- data.tar.gz: 1435d44fa6d8599e5ba9492fbce3bb5e30dba57e24c225f7ed6cbfd87ae56f7f3cca5820e9c94a7d259ca652e8875ec5ea503ebb1839969561cf99c5c5f28b7c
6
+ metadata.gz: f25658cea0878061423c1761a5017fcbc4e78535bbce0175266539732f7eb862db30342d7a7276e182a71461548f021112c460c8d253dabc5624d17bc2597285
7
+ data.tar.gz: 7cd9478c899d770e8cb15e1d83f1e0a030783ac3f5f10bdf99d2e8c046588001c77818b9d6abeb900fa2b979fa9bd47f87427f2305db0074d4cd501b4daabb77
@@ -388,22 +388,28 @@ case options
388
388
  end
389
389
  health(what,value)
390
390
  when -> (cre) { cre[:create_user] }
391
- puts "Creating User".green if !$QUIET
392
391
  if options[:create_user]
393
392
  value=check_string_sanity(options[:create_user])
394
393
  username_sanity(value)
394
+ puts "Creating User #{value}".green if !$QUIET
395
395
  what='add_user'
396
- if !options[:role]
397
- puts "You need to select one of the valid Roles".red
396
+ if !options[:role] || options[:role] != "Super" && options[:role] != "User"
397
+ puts "You need to select one of the valid Roles (Super or User)".red
398
398
  exit 1
399
399
  else
400
400
  print "Please type the password twice for user #{value}.\n\t"
401
401
  new_password=STDIN.getpass('Password: ')
402
402
  print "\t"
403
403
  confirm=STDIN.getpass('Confirm: ')
404
+ password_sanity(new_password)
404
405
  if new_password == confirm
405
- password_sanity(new_password)
406
- user_mgmt(what,value,new_password,options[:role])
406
+ if add_user(value,new_password,options[:role])
407
+ puts "User #{value} added successfully".green
408
+ exit 0
409
+ else
410
+ puts "Failed to add User #{value}".red
411
+ exit 1
412
+ end
407
413
  end
408
414
  end
409
415
  end
@@ -534,7 +540,6 @@ case options
534
540
  if opt_action == "P"
535
541
  print "Please type new password for user #{user_work} .\n\t"
536
542
  new_password=STDIN.getpass('Password: ')
537
- puts "testing #{new_password}"
538
543
  print "\t"
539
544
  check_password=STDIN.getpass('Confirm: ')
540
545
  if new_password != check_password
@@ -312,6 +312,17 @@ def change_username(user,new_user)
312
312
  end
313
313
  end
314
314
 
315
+ def add_user(user,password,role)
316
+ result = api_caller({"action" => "create-user", "user" => user, "password" => password, "role" => role},true)
317
+ if result['error']
318
+ return false
319
+ end
320
+ if result['success']
321
+ return true
322
+ end
323
+ end
324
+
325
+
315
326
  def change_role(user,new_role)
316
327
  result = api_caller({"action" => "change-role", "username" => user, "new-role" => new_role},true)
317
328
  if result['error']
@@ -334,7 +345,7 @@ def password_sanity(password)
334
345
  end
335
346
 
336
347
  def username_sanity(username)
337
- if new_user.length < MIN_USER
348
+ if username.length < MIN_USER
338
349
  puts "New Username is shorter than #{MIN_USER} chars, please use a bigger username.".red
339
350
  exit 1
340
351
  end
@@ -359,4 +370,4 @@ def local_version
359
370
  return
360
371
  end
361
372
 
362
- VERSION_SIGN="0.0.20"
373
+ VERSION_SIGN="0.0.21"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phoseum-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julio C Hegedus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-22 00:00:00.000000000 Z
11
+ date: 2020-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yaml