aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-03-10 04:23:58 +0300
committerFrederick Muriuki Muriithi2023-03-10 04:23:58 +0300
commitbaef6481ac5eb6ab8cd8196637894b794e44283b (patch)
tree43b5e4b8b7dbf0a41a2b988ffb3a1e29897ff4af
parent726460a2ca4817a1b7a5c7798147996d7b7e5e2d (diff)
downloadgenenetwork3-baef6481ac5eb6ab8cd8196637894b794e44283b.tar.gz
auth: data-migration: Fix minor bugs
-rw-r--r--gn3/auth/authorisation/data/views.py8
-rw-r--r--main.py2
2 files changed, 5 insertions, 5 deletions
diff --git a/gn3/auth/authorisation/data/views.py b/gn3/auth/authorisation/data/views.py
index 1343f47..1b453a3 100644
--- a/gn3/auth/authorisation/data/views.py
+++ b/gn3/auth/authorisation/data/views.py
@@ -130,7 +130,7 @@ def migrate_user_group(conn: db.DbConnection, user: User) -> Group:
group = user_group(conn, user).maybe(# type: ignore[misc]
False, lambda grp: grp) # type: ignore[arg-type]
if not bool(group):
- group = Group(uuid.UUID(), f"{user.name}'s Group", {
+ group = Group(uuid.uuid4(), f"{user.name}'s Group", {
"created": datetime.datetime.now().isoformat(),
"notes": "Imported from redis"
})
@@ -224,8 +224,8 @@ def migrate_user_data():
try:
user_id = uuid.UUID(request.form.get("user_id", ""))
email = validate_email(request.form.get("email", ""))
- username = validate_username(
- request.form.get("username", ""))
+ fullname = validate_username(
+ request.form.get("fullname", ""))
password = validate_password(
request.form.get("password", ""),
request.form.get("confirm_password", ""))
@@ -234,7 +234,7 @@ def migrate_user_data():
redis.Redis(decode_responses=True) as rconn,
gn3db.database_connection() as gn3conn):
user = migrate_user(
- authconn, user_id, email["email"], username,
+ authconn, user_id, email["email"], fullname,
password)
group = migrate_user_group(authconn, user)
user_resource_data = migrate_data(
diff --git a/main.py b/main.py
index 1fda2d3..6890b33 100644
--- a/main.py
+++ b/main.py
@@ -79,7 +79,7 @@ def init_dev_clients():
"redirect_uris": ["http://localhost:5033/oauth2/code"],
"response_type": "token", # choices: ["code", "token"]
"scope": ["profile", "group", "role", "resource", "register-client",
- "user"]
+ "user", "migrate-data", "introspect"]
}),
"user_id": "0ad1917c-57da-46dc-b79e-c81c91e5b928"},)