keycloak-admin 1.0.20 → 1.0.21
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +16 -1
- data/lib/keycloak-admin/client/group_client.rb +13 -0
- data/lib/keycloak-admin/resource/group_resource.rb +4 -0
- data/lib/keycloak-admin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a01d12df8eb75fcedbf128aacae50192983a47cb4cfac6c52b1dff4d999aa08
|
4
|
+
data.tar.gz: dae8911b975b7aea1989fc8df565047c144da55868569da02039c53fbc8d6963
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f44444327adcb4622856a7397401b5eaeaa10ad55943cce4606f4539340795a2e444f48613c35cdedb41c34431516b9137fec07f163d51c5e7c691ce3a7db17
|
7
|
+
data.tar.gz: 2210584caebc4c01e67a7da99740910755759a1edb22fb5c48002c0e51eb3d672460a74723db38bdc0bc639c2effd1cc42e4a8d30b79e185ce0d31a3a6c8ea72
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,10 @@ 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.21] - 2023-02-03
|
9
|
+
|
10
|
+
* List users who are a member of a group (thanks to @tlloydthwaites)
|
11
|
+
|
8
12
|
## [1.0.20] - 2022-12-26
|
9
13
|
|
10
14
|
* Create subgroups (thanks to @neckhair)
|
data/Gemfile.lock
CHANGED
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.
|
15
|
+
gem "keycloak-admin", "1.0.21"
|
16
16
|
```
|
17
17
|
|
18
18
|
## Login
|
@@ -119,6 +119,7 @@ All options have a default value. However, all of them can be changed in your in
|
|
119
119
|
* Get list of roles, save a role
|
120
120
|
* Get list of realms, save/update/delete a realm
|
121
121
|
* Get list of client role mappings for a user/group
|
122
|
+
* Get list of members of a group
|
122
123
|
* Save client role mappings for a user/group
|
123
124
|
* Save realm-level role mappings for a user/group
|
124
125
|
* Add a Group on a User
|
@@ -320,6 +321,20 @@ group_name = "test"
|
|
320
321
|
sub_group_id = KeycloakAdmin.realm("a_realm").groups.create_subgroup!(parent_id, group_name)
|
321
322
|
```
|
322
323
|
|
324
|
+
### Get list of members of a group
|
325
|
+
|
326
|
+
Returns an array of `KeycloakAdmin::UserRepresentation`.
|
327
|
+
|
328
|
+
```ruby
|
329
|
+
KeycloakAdmin.realm("a_realm").group("group_id").members
|
330
|
+
```
|
331
|
+
|
332
|
+
You can specify paging with `first` and `max`:
|
333
|
+
|
334
|
+
```ruby
|
335
|
+
KeycloakAdmin.realm("a_realm").group("group_id").members(first:0, max:100)
|
336
|
+
```
|
337
|
+
|
323
338
|
### Get list of roles in a realm
|
324
339
|
|
325
340
|
Returns an array of `KeycloakAdmin::RoleRepresentation`.
|
@@ -35,6 +35,19 @@ module KeycloakAdmin
|
|
35
35
|
end
|
36
36
|
created_id(response)
|
37
37
|
end
|
38
|
+
|
39
|
+
def members(group_id, first=0, max=100)
|
40
|
+
url = "#{groups_url(group_id)}/members"
|
41
|
+
query = {first: first.try(:to_i), max: max.try(:to_i)}.compact
|
42
|
+
unless query.empty?
|
43
|
+
query_string = query.to_a.map { |e| "#{e[0]}=#{e[1]}" }.join("&")
|
44
|
+
url = "#{url}?#{query_string}"
|
45
|
+
end
|
46
|
+
response = execute_http do
|
47
|
+
RestClient::Resource.new(url, @configuration.rest_client_options).get(headers)
|
48
|
+
end
|
49
|
+
JSON.parse(response).map { |user_as_hash| UserRepresentation.from_hash(user_as_hash) }
|
50
|
+
end
|
38
51
|
|
39
52
|
def groups_url(id=nil)
|
40
53
|
if id
|
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.
|
4
|
+
version: 1.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lorent Lempereur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-cookie
|