stages/user_write: dynamic groups (#2901)

* stages/user_write: add dynamic groups

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

* simplify functions

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens L
2022-05-19 20:28:16 +02:00
committed by GitHub
parent a500ff28ac
commit 7bdecd2ee6
3 changed files with 56 additions and 27 deletions

View File

@ -5,3 +5,15 @@ title: User write stage
This stages writes data from the current context to the current pending user. If no user is pending, a new one is created.
Newly created users can be created as inactive and can be assigned to a selected group.
### Dynamic groups
Starting with authentik 2022.5, users can be added to dynamic groups. To do so, simply set `groups` in the flow plan context before this stage is run, for example
```python
from authentik.core.models import Group
group, _ = Group.objects.get_or_create(name="some-group")
# ["groups"] *must* be set to an array of Group objects, names alone are not enough.
request.context["groups"] = [group]
return True
```