Default group required

* adds access checks depending on the current group confgiguration of a user
* removes buttons for adding/editing or removing data if default group is not set for a user
* removes buttons for adding/removing related data in unshared interventions
* removes shared-user setting from share menu of an intervention if user is not zb or ets
* renames has_access() from intervention Model into is_shared_with() for more clarity
* fixes bug in group check in_group() from utils.py
This commit is contained in:
mipel
2021-08-02 16:23:29 +02:00
parent 78d6feabb6
commit 0a523d0a1a
10 changed files with 62 additions and 19 deletions

View File

@@ -5,6 +5,7 @@ Contact: michel.peltriaux@sgdnord.rlp.de
Created on: 02.07.21
"""
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.models import User
@@ -18,4 +19,6 @@ def in_group(user: User, group: str) -> bool:
Returns:
bool
"""
return group in user.groups.values("name")
return user.groups.filter(
name=_(group)
)