summaryrefslogtreecommitdiffstats
path: root/src/resource_inventory
diff options
context:
space:
mode:
Diffstat (limited to 'src/resource_inventory')
-rw-r--r--src/resource_inventory/resource_manager.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/resource_inventory/resource_manager.py b/src/resource_inventory/resource_manager.py
index e14218b..c8b2b05 100644
--- a/src/resource_inventory/resource_manager.py
+++ b/src/resource_inventory/resource_manager.py
@@ -7,11 +7,13 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
import re
+from django.db.models import Q
from dashboard.exceptions import ResourceAvailabilityException
from resource_inventory.models import (
ResourceBundle,
+ ResourceTemplate,
Network,
Vlan,
PhysicalNetwork,
@@ -31,6 +33,11 @@ class ResourceManager:
ResourceManager.instance = ResourceManager()
return ResourceManager.instance
+ def getAvailableResourceTemplates(self, lab, user):
+ templates = ResourceTemplate.objects.filter(lab=lab)
+ templates.filter(Q(owner=user) | Q(public=True))
+ return templates
+
def templateIsReservable(self, resource_template):
"""
Check if the required resources to reserve this template is available.