policies/expression: add ak_user_has_authenticator

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-09-20 19:13:41 +02:00
parent 8f7d21b692
commit 95a2fddfa8
3 changed files with 34 additions and 6 deletions

View File

@ -25,6 +25,23 @@ ak_message("Access denied")
return False
```
### `ak_user_has_authenticator(user: User, device_type: Optional[str] = None)` (2021.9+)
Check if a user has any authenticator devices. Only fully validated devices are counted.
Optionally, you can filter a specific device type. The following options are valid:
- `totp`
- `duo`
- `static`
- `webauthn`
Example:
```python
return ak_user_has_authenticator(request.user)
```
import Functions from '../expressions/_functions.md'
<Functions />