#38 User requests
* implements 3) "Extend sharing on direct adding of users"
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user