keycloak-admin 1.0.23 → 1.0.24

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: 6c879f2b531c38afe86fddf58a5576144dae79b49c3d3b060f513db16a892c15
4
- data.tar.gz: 23ef8ec0e9bdb1a35469b065d67c8683b2fd8bb76d03d7c49740fa0fd2946652
3
+ metadata.gz: f6bc5dc390440dedbf6a682c53717e334e4f174b31e43b7990dae87bed2e0bbf
4
+ data.tar.gz: b37367aaa9726b48a266b55baf7fcebf772f302c18f215ad0e694d6e60421608
5
5
  SHA512:
6
- metadata.gz: 6b12423e5046fb3d98a0352e08893c78c8d6531e46ab74eff30b09ab7d4cb478a5067ecc0e606ff3075d01a00b26fe1bfa14cb4e6218bdb5bc0e89b86a3a0857
7
- data.tar.gz: e9b5fc218bc384bc79b17ecc7564cc414a0525d43b90d503964ce9703b67636c307ac2618c83cbd52be8066da8096d06c262892c535c7b503044b3e4391e78ad
6
+ metadata.gz: 869a2108bbffcdc242a438a20b6d8c06fa907354e2d0648cac91920d08ba070b2bf9cc35d710f1a1fcb40691176b84b515372af540bdc7383d4835217e9ce989
7
+ data.tar.gz: ed68ed6de159d1d0bf87c298b49fab7fc94cc1d5f563ef25a2b56e922807ddb98b9fba69f189bc7ccc843380595afce42cc202e14b53f07fcc97f7c141145e43
data/CHANGELOG.md CHANGED
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.24] - 2023-06-07
9
+
10
+ * Revert the modifications on the feature 'Update a User' introduced in `1.0.22`. This implementation had breaking changes such as not being able to update several attributes (`first_name`, `email`, etc).
8
11
 
9
12
  ## [1.0.23] - 2023-06-01
10
13
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- keycloak-admin (1.0.23)
4
+ keycloak-admin (1.0.24)
5
5
  http-cookie (~> 1.0, >= 1.0.3)
6
6
  rest-client (~> 2.0)
7
7
 
data/README.md CHANGED
@@ -12,7 +12,7 @@ This gem *does not* require Rails.
12
12
  For example, using `bundle`, add this line to your Gemfile.
13
13
 
14
14
  ```ruby
15
- gem "keycloak-admin", "1.0.23"
15
+ gem "keycloak-admin", "1.0.24"
16
16
  ```
17
17
 
18
18
  ## Login
@@ -20,19 +20,16 @@ module KeycloakAdmin
20
20
  user_representation
21
21
  end
22
22
 
23
- def update(user_id, payload = {})
23
+ def update(user_id, user_representation_body)
24
24
  raise ArgumentError.new("user_id must be defined") if user_id.nil?
25
-
26
- user = UserRepresentation.new
27
- user.first_name = payload[:name]
28
- user.enabled = payload[:enabled]
29
- user.attributes = payload[:attributes]
30
- execute_http do
31
- RestClient::Resource.new(users_url(user_id), @configuration.rest_client_options).put(
32
- create_payload(user), headers
25
+ RestClient::Request.execute(
26
+ @configuration.rest_client_options.merge(
27
+ method: :put,
28
+ url: users_url(user_id),
29
+ payload: create_payload(user_representation_body),
30
+ headers: headers
33
31
  )
34
- end
35
- true
32
+ )
36
33
  end
37
34
 
38
35
  def add_group(user_id, group_id)
@@ -1,3 +1,3 @@
1
1
  module KeycloakAdmin
2
- VERSION = "1.0.23"
2
+ VERSION = "1.0.24"
3
3
  end
@@ -289,15 +289,26 @@ RSpec.describe KeycloakAdmin::TokenClient do
289
289
  @user_client = KeycloakAdmin.realm(realm_name).users
290
290
 
291
291
  stub_token_client
292
- allow_any_instance_of(RestClient::Resource).to receive(:put)
292
+ allow_any_instance_of(RestClient::Request).to receive(:execute).and_return "write a better test"
293
293
  end
294
294
 
295
295
  context 'when user_id is defined' do
296
296
  let(:user_id) { '95985b21-d884-4bbd-b852-cb8cd365afc2' }
297
297
 
298
298
  it 'updates the user details' do
299
- response = @user_client.update(user_id, { name: 'Test', enabled: false })
300
- expect(response).to be_truthy
299
+ ## TODO use this expected payload to check whether it has been sent or not
300
+ expected_payload = {
301
+ method: :put,
302
+ url: "http://auth.service.io/auth/admin/realms/valid-realm/users/95985b21-d884-4bbd-b852-cb8cd365afc2",
303
+ payload: '{"firstName":"Test","enabled":false}',
304
+ headers: {
305
+ Authorization: "Bearer test_access_token",
306
+ content_type: :json,
307
+ accept: :json
308
+ }
309
+ }
310
+ response = @user_client.update(user_id, { firstName: 'Test', enabled: false })
311
+ expect(response).to eq "write a better test"
301
312
  end
302
313
  end
303
314
 
@@ -306,7 +317,7 @@ RSpec.describe KeycloakAdmin::TokenClient do
306
317
 
307
318
  let(:user_id) { nil }
308
319
  it 'raise argument error' do
309
- expect { @user_client.update(user_id, { name: 'Test', enabled: false }) }.to raise_error(ArgumentError)
320
+ expect { @user_client.update(user_id, { firstName: 'Test', enabled: false }) }.to raise_error(ArgumentError)
310
321
  end
311
322
  end
312
323
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keycloak-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.23
4
+ version: 1.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorent Lempereur
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-31 00:00:00.000000000 Z
11
+ date: 2023-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-cookie