aboutsummaryrefslogtreecommitdiff
path: root/gn3/auth/authorisation/groups.py
blob: ad30763e422e9cf8d33238adf18b5c6f0cc8c77d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Handle the management of resource/user groups."""
import uuid

from gn3.auth import db
from . import authorised_p

@authorised_p(
    ("create-group",), success_message="Successfully created group.",
    error_message="Failed to create group.")
def create_group(conn, group_name):
    with db.cursor(conn) as cursor:
        group_id = uuid.uuid4()
        cursor.execute(
            "INSERT INTO groups(group_id, group_name) VALUES (?, ?)",
            (str(group_id), group_name))
        return group_id