diff options
author | Frederick Muriuki Muriithi | 2023-05-25 06:02:38 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-05-25 06:18:25 +0300 |
commit | 8593d882ed1eea226eeefabaa66135df2374746f (patch) | |
tree | 972d233da4b6fa9238263277b579880e0862aeaa /gn3/auth/authorisation/resources/models.py | |
parent | 5f9f4ff97c27a0f34a86eec516ab3f58faf5937e (diff) | |
download | genenetwork3-8593d882ed1eea226eeefabaa66135df2374746f.tar.gz |
Set whether resource is publicly viewable on creation
Diffstat (limited to 'gn3/auth/authorisation/resources/models.py')
-rw-r--r-- | gn3/auth/authorisation/resources/models.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gn3/auth/authorisation/resources/models.py b/gn3/auth/authorisation/resources/models.py index e54ec48..2016960 100644 --- a/gn3/auth/authorisation/resources/models.py +++ b/gn3/auth/authorisation/resources/models.py @@ -84,7 +84,8 @@ def __assign_resource_owner_role__(cursor, resource, user): oauth2_scope="profile resource") def create_resource( conn: db.DbConnection, resource_name: str, - resource_category: ResourceCategory, user: User) -> Resource: + resource_category: ResourceCategory, user: User, + public: bool) -> Resource: """Create a resource item.""" with db.cursor(conn) as cursor: group = user_group(conn, user).maybe( @@ -92,7 +93,8 @@ def create_resource( if not group: raise MissingGroupError( "User with no group cannot create a resource.") - resource = Resource(group, uuid4(), resource_name, resource_category, False) + resource = Resource( + group, uuid4(), resource_name, resource_category, public) cursor.execute( "INSERT INTO resources VALUES (?, ?, ?, ?, ?)", (str(resource.group.group_id), str(resource.resource_id), |