enfcli 3.9.6.pre.beta → 3.10.0.pre.alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c836073fa8165cb90c99b1935e062801b6f8f192b24e6609c6144453b49a8e12
4
- data.tar.gz: fb0fee350a8dc9312f8280de04c5ca96db9cb548064d8924fa669a7ba85e4f00
3
+ metadata.gz: 1d52e92baf1ae781f64aee413ccc67199cffd957b551fdee6bf431d04e8df87c
4
+ data.tar.gz: 4e501ceae035618f9cfd283fcfea0d55c3cca29d765ef2704c90d8f7f3dbdfbe
5
5
  SHA512:
6
- metadata.gz: 490d4201d5e8bfc2ef6333e7f7a95273a56edf412272345c57c087ef2bb94c3a3b72dafb8d4426393d472c8d15ca941bb5eb3a228d6bab2b7c297d74365f458a
7
- data.tar.gz: 5e96903a0f9a25cb5a1e5720fe699b6d125e02ce581483e775f32fb91987aaa0b7f406eb5ab0f4e18015fd349682b8b8ee2ea0f9b17f2052ab74924323687c5b
6
+ metadata.gz: 426a4558776eb5a8763cc9a0542b241a26d0f82d1a4dc66cf7a1a42d163425a205c623d603942290d18e03cc762e875819f0bfdcaf55fde58bed43c6aab27b0d
7
+ data.tar.gz: 619106ed6b7ec32424c196b3e17df89b52d19269f43352ef8a45a7bb418a900592c19c697b2fb8fa5b81f5b59008560dcb0e3d7f751ae43cc171bc759027ee56
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enfcli (3.9.6.pre.beta)
4
+ enfcli (3.10.0.pre.alpha)
5
5
  rest-client (~> 2.0)
6
6
  terminal-table
7
7
  thor (~> 0.20.0)
@@ -24,9 +24,9 @@ GEM
24
24
  http-accept (1.7.0)
25
25
  http-cookie (1.0.3)
26
26
  domain_name (~> 0.5)
27
- mime-types (3.3)
27
+ mime-types (3.2.2)
28
28
  mime-types-data (~> 3.2015)
29
- mime-types-data (3.2019.1009)
29
+ mime-types-data (3.2019.0331)
30
30
  netrc (0.11.0)
31
31
  public_suffix (3.0.3)
32
32
  rake (10.5.0)
data/lib/enfapi.rb CHANGED
@@ -501,7 +501,6 @@ module EnfApi
501
501
 
502
502
  def list_domain_users(domain_network)
503
503
  @api["/api/xcr/v2/domains/#{domain_network}/users"].get( @headers) {|response, request, result|
504
- puts response.code
505
504
  process_api_response response, request, result
506
505
  }
507
506
  end
@@ -531,6 +530,13 @@ module EnfApi
531
530
  }
532
531
  end
533
532
 
533
+ def update_user_status(user_id, status)
534
+ json = to_json( status )
535
+ @api["/api/xcr/v2/users/#{user_id}/status"].put( json, @headers) { |response, request, result|
536
+ process_api_response response, request, result
537
+ }
538
+ end
539
+
534
540
  ############################################################################################################################
535
541
  # Private functions
536
542
  ############################################################################################################################
@@ -32,9 +32,10 @@ module EnfCli
32
32
  end
33
33
 
34
34
  def display_users users
35
- headings = ['User Name', 'Full Name', 'Last Login', 'Type', 'Reset Code', 'Reset Time']
35
+ headings = ['Id', 'User Name', 'Full Name', 'Last Login', 'Type', 'Reset Code', 'Reset Time', 'Status']
36
36
  rows = users.map{ |hash|
37
- [ hash[:username], hash[:full_name], hash[:last_login], hash[:type], hash[:reset_code], format_date(hash[:reset_time])]
37
+ [ hash[:user_id], hash[:username], hash[:full_name], hash[:last_login], hash[:type], hash[:reset_code],
38
+ format_date(hash[:reset_time]), hash[:status] ]
38
39
  }
39
40
  render_table(headings, rows)
40
41
  end
@@ -228,6 +229,33 @@ module EnfCli
228
229
  end
229
230
  end
230
231
 
232
+ desc "deactivate-user", "Deactivate User"
233
+ method_option :user_id, :required => true, :type => :numeric
234
+ def deactivate_user
235
+ try_with_rescue_in_session do
236
+
237
+ ## call the api
238
+ status = { :status => "INACTIVE" }
239
+ EnfApi::API.instance.update_user_status options[:user_id], status
240
+
241
+ say "Deactivated user!", :green
242
+
243
+ end
244
+ end
245
+
246
+ desc "activate-user", "Activate User"
247
+ method_option :user_id, :required => true, :type => :numeric
248
+ def activate_user
249
+ try_with_rescue_in_session do
250
+
251
+ ## call the api
252
+ status = { :status => "ACTIVE" }
253
+ EnfApi::API.instance.update_user_status options[:user_id], status
254
+
255
+ say "Activated user!", :green
256
+
257
+ end
258
+ end
231
259
 
232
260
  end
233
261
 
@@ -14,5 +14,5 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module EnfCli
17
- VERSION = '3.9.6-beta'
17
+ VERSION = '3.10.0-alpha'
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enfcli
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.6.pre.beta
4
+ version: 3.10.0.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Venkatakumar Srinivasan