-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathgroups.py
More file actions
38 lines (31 loc) · 915 Bytes
/
groups.py
File metadata and controls
38 lines (31 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import json
from keycloak.admin import KeycloakAdminBase
__all__ = ('Groups',)
class Groups(KeycloakAdminBase):
_paths = {
'collection': '/admin/realms/{realm}/groups',
}
def __init__(self, realm_name, *args, **kwargs):
self._realm_name = realm_name
super(Groups, self).__init__(*args, **kwargs)
def all(self):
return self._client.get(
url=self._client.get_full_url(
self.get_path(
'collection',
realm=self._realm_name
)
),
)
def create(self, name):
return self._client.post(
url=self._client.get_full_url(
self.get_path(
'collection',
realm=self._realm_name
)
),
data=json.dumps({
"name": name
})
)