diff options
author | Frederick Muriuki Muriithi | 2025-07-31 10:25:07 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-07-31 10:29:38 -0500 |
commit | 471240cd5251b3f5d5bc9e45b2068eb4fe1036c6 (patch) | |
tree | 12b036c7414dd72009962dec9245b656cac1d8db /gn_auth/auth/authorisation/resources/inbredset/models.py | |
parent | ea48cd7048854a10c2a305f9d00106077ed317a1 (diff) | |
download | gn-auth-471240cd5251b3f5d5bc9e45b2068eb4fe1036c6.tar.gz |
Break circular dependency - move utility function to module of use.
Diffstat (limited to 'gn_auth/auth/authorisation/resources/inbredset/models.py')
-rw-r--r-- | gn_auth/auth/authorisation/resources/inbredset/models.py | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/gn_auth/auth/authorisation/resources/inbredset/models.py b/gn_auth/auth/authorisation/resources/inbredset/models.py index 3bc65d2..2626f3e 100644 --- a/gn_auth/auth/authorisation/resources/inbredset/models.py +++ b/gn_auth/auth/authorisation/resources/inbredset/models.py @@ -5,37 +5,8 @@ from typing import Sequence, Optional import sqlite3 import gn_auth.auth.db.sqlite3 as db -from gn_auth.auth.errors import NotFoundError from gn_auth.auth.authentication.users import User -from gn_auth.auth.authorisation.resources.groups.models import Group -from gn_auth.auth.authorisation.resources.base import Resource, ResourceCategory -from gn_auth.auth.authorisation.resources.models import ( - create_resource as _create_resource) - -def create_resource( - cursor: sqlite3.Cursor, - resource_name: str, - user: User, - group: Group, - public: bool -) -> Resource: - """Convenience function to create a resource of type 'inbredset-group'.""" - cursor.execute("SELECT * FROM resource_categories " - "WHERE resource_category_key='inbredset-group'") - category = cursor.fetchone() - if category: - return _create_resource(cursor, - resource_name, - ResourceCategory( - resource_category_id=UUID( - category["resource_category_id"]), - resource_category_key="inbredset-group", - resource_category_description=category[ - "resource_category_description"]), - user, - group, - public) - raise NotFoundError("Could not find a 'inbredset-group' resource category.") +from gn_auth.auth.authorisation.resources.base import Resource def assign_inbredset_group_owner_role( |