aboutsummaryrefslogtreecommitdiffstats
path: root/src/workflow
diff options
context:
space:
mode:
authorSawyer Bergeron <sbergeron@iol.unh.edu>2019-04-08 13:17:45 -0400
committerSawyer Bergeron <sbergeron@iol.unh.edu>2019-04-16 12:51:41 -0400
commitb3a44b5d833b0d02735bc2c42d5981c0368da7a6 (patch)
tree21cbc69f5fdbefb9960f89e1100572d8da2e9c71 /src/workflow
parent4391d9794ba82e609acc7fff43b8ae449fcb87c7 (diff)
Limit total number of active bookings per user
Change-Id: I4f79e3225f423274de3d2da912a080521447b185 Signed-off-by: Sawyer Bergeron <sbergeron@iol.unh.edu>
Diffstat (limited to 'src/workflow')
-rw-r--r--src/workflow/models.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/workflow/models.py b/src/workflow/models.py
index cdfddef..7d24668 100644
--- a/src/workflow/models.py
+++ b/src/workflow/models.py
@@ -143,10 +143,12 @@ class BookingAuthManager():
currently checks if the booking uses multiple servers. if it does, then the owner must be a PTL,
which is checked using the provided info file
"""
- if len(booking.resource.template.getHosts()) < 2:
- return True # if they only have one server, we dont care
if booking.owner.userprofile.booking_privledge:
return True # admin override for this user
+ if Booking.objects.filter(owner=booking.owner, end__gt=timezone.now()).count() >= 3:
+ return False
+ if len(booking.resource.template.getHosts()) < 2:
+ return True # if they only have one server, we dont care
if repo.BOOKING_INFO_FILE not in repo.el:
return False # INFO file not provided
ptl_info = self.parse_url(repo.el.get(repo.BOOKING_INFO_FILE))