Fix RolePermissions merge

This commit is contained in:
Yohann D'ANELLO 2020-07-25 20:07:45 +02:00
parent 55bc288deb
commit 4c29d855d2
1 changed files with 5 additions and 5 deletions

View File

@ -37,17 +37,17 @@ class PermissionBackend(ModelBackend):
return Permission.objects.none() return Permission.objects.none()
qs = Permission.objects.annotate( qs = Permission.objects.annotate(
club=F("role__role__membership__club"), club=F("role__membership__club"),
membership=F("role__role__membership"), membership=F("role__membership"),
).filter( ).filter(
( (
Q( Q(
role__role__membership__date_start__lte=timezone.now().today(), role__membership__date_start__lte=timezone.now().today(),
role__role__membership__date_end__gte=timezone.now().today(), role__membership__date_end__gte=timezone.now().today(),
) )
| Q(permanent=True) | Q(permanent=True)
) )
& Q(role__role__membership__user=user) & Q(role__membership__user=user)
& Q(type=t) & Q(type=t)
& Q(mask__rank__lte=get_current_session().get("permission_mask", 0)) & Q(mask__rank__lte=get_current_session().get("permission_mask", 0))
) )