aboutsummaryrefslogtreecommitdiff
path: root/gn3/auth
diff options
context:
space:
mode:
Diffstat (limited to 'gn3/auth')
-rw-r--r--gn3/auth/authorisation/resources.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/gn3/auth/authorisation/resources.py b/gn3/auth/authorisation/resources.py
new file mode 100644
index 0000000..d01c435
--- /dev/null
+++ b/gn3/auth/authorisation/resources.py
@@ -0,0 +1,27 @@
+"""Handle the management of resources."""
+from uuid import UUID
+from typing import NamedTuple
+
+from gn3.auth import db
+from .groups import Group
+from .checks import authorised_p
+
+class ResourceCategory(NamedTuple):
+ """Class representing a resource category."""
+ resource_category_id: UUID
+ resource_category_key: str
+ resource_category_description: str
+
+class Resource(NamedTuple):
+ """Class representing a resource."""
+ group: Group
+ resource_id: UUID
+ resource_name: str
+ resource_category: ResourceCategory
+
+@authorised_p(("create-resource",), error_message="Could not create resource")
+def create_resource(
+ conn: db.DbConnection, resource_name: str,
+ resource_category: ResourceCategory):
+ """Create a resource item."""
+ return tuple()