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 +4 -4
- data/Gemfile.lock +3 -3
- data/lib/enfapi.rb +7 -1
- data/lib/enfcli/commands/user.rb +30 -2
- data/lib/enfcli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d52e92baf1ae781f64aee413ccc67199cffd957b551fdee6bf431d04e8df87c
|
4
|
+
data.tar.gz: 4e501ceae035618f9cfd283fcfea0d55c3cca29d765ef2704c90d8f7f3dbdfbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
27
|
+
mime-types (3.2.2)
|
28
28
|
mime-types-data (~> 3.2015)
|
29
|
-
mime-types-data (3.2019.
|
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
|
############################################################################################################################
|
data/lib/enfcli/commands/user.rb
CHANGED
@@ -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],
|
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
|
|
data/lib/enfcli/version.rb
CHANGED