* No detailed permissions due to django constraints on model-based permissions * instead: logic controlled permission by group membership * adds translations
22 lines
488 B
Python
22 lines
488 B
Python
"""
|
|
Author: Michel Peltriaux
|
|
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
|
Contact: michel.peltriaux@sgdnord.rlp.de
|
|
Created on: 02.07.21
|
|
|
|
"""
|
|
from django.contrib.auth.models import User
|
|
|
|
|
|
def in_group(user: User, group: str) -> bool:
|
|
""" Checks if the user is part of a group
|
|
|
|
Args:
|
|
user (User): The user object
|
|
group (str): The group's name
|
|
|
|
Returns:
|
|
bool
|
|
"""
|
|
return group in user.groups.values("name")
|