Skip to content

Commit f4c6044

Browse files
committed
CH-152 add documentation
1 parent 5e6f324 commit f4c6044

1 file changed

Lines changed: 30 additions & 3 deletions

File tree

docs/accounts.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,35 @@ harness:
178178

179179
The above configuration will create 3 client roles under the "myapp" client and 2 users.
180180

181-
---
181+
182182
**NOTE**
183-
Users and client roles are defined as a one-off initialization: they
183+
> Users and client roles are defined as a one-off initialization: they
184184
can be configured only on a new deployment and cannot be updated.
185-
---
185+
186+
187+
### Retrieve user attributes Python API
188+
189+
The auth API provides a way to get user attributes merged with groups attributes recursively.
190+
This allows us to define an attribute that is common for different users per group.
191+
A common use case is the definition of usage quotas, for which cloudharness provides a
192+
high level API.
193+
194+
Example retrieve attributes:
195+
196+
```Python
197+
from clouharness.auth.user_attributes import get_user_attributes
198+
199+
attributes = get_user_attributes(kc_user_id_or_name)
200+
```
201+
202+
The API provides parameters for filtering and provide a set of default values.
203+
204+
The user quotas API also assumes that a set of default values can be specified at application level
205+
on `harness/quotas` and all quotas attributes begin with the `quota-` prefix.
206+
207+
Example:
208+
209+
```Python
210+
from clouharness.auth.quotas import get_user_quotas
211+
quotas = get_user_quotas(kc_user_id_or_name) # retrieves default quotas values from the current application
212+
```

0 commit comments

Comments
 (0)