Commit 16e9df8f authored by Lukas Burgey's avatar Lukas Burgey

Add services property to user

parent 48b26b31
......@@ -5,6 +5,7 @@ import logging
from django.contrib.auth.models import AbstractUser, Group
from django.db import models
from django.db.models import Q
from django.db.models.signals import post_save
from django.dispatch import receiver
from django_mysql.models import JSONField
......@@ -98,6 +99,16 @@ class User(AbstractUser):
'ssh_key': self.ssh_keys.all(),
}
@property
def services(self):
from ..models import Service
return (
Service.objects
.filter(
Q(groups__user=self)
).distinct()
)
@property
def is_active_at_clients(self):
return self._is_active
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment