#38 User requests

* implements 3) "Extend sharing on direct adding of users"
This commit is contained in:
2021-11-15 14:00:08 +01:00
parent faffd454b9
commit 6ec37dbe11
7 changed files with 147 additions and 69 deletions

View File

@@ -7,6 +7,8 @@ Created on: 02.07.21
"""
from django.contrib.auth.models import User
from konova.settings import ETS_GROUP, ZB_GROUP
def in_group(user: User, group: str) -> bool:
""" Checks if the user is part of a group
@@ -21,3 +23,15 @@ def in_group(user: User, group: str) -> bool:
return user.groups.filter(
name=group
)
def is_default_group_only(user: User) -> bool:
""" Checks if the user is only part of the default group
Args:
user (User): The user object
Returns:
bool
"""
return not in_group(user, ZB_GROUP) and not in_group(user, ETS_GROUP)