Update sessions on user permissions update
Currently an update to a user's administrative status is reflected in the database and store but not in that user's session.
diff --git a/virtool/api/subtractions.py b/virtool/api/subtractions.py
index ec7a6dfdc..80c6543e9 100644
--- a/virtool/api/subtractions.py
+++ b/virtool/api/subtractions.py
@@ -156,6 +156,8 @@ async def edit(req):
     if document is None:
         return not_found()
 
+    document["linked_samples"] = await virtool.db.subtractions.get_linked_samples(db, subtraction_id)
+
     return json_response(virtool.utils.base_processor(document))
 
 
diff --git a/virtool/db/hmm.py b/virtool/db/hmm.py
index d003c18c5..a389368eb 100644
--- a/virtool/db/hmm.py
+++ b/virtool/db/hmm.py
@@ -189,7 +189,8 @@ async def install(app, process_id, release, user_id):
         db,
         process_id,
         release["size"],
-        0.4
+        factor=0.4,
+        increment=0.01
     )
 
     with virtool.utils.get_temp_dir() as tempdir:
diff --git a/virtool/db/references.py b/virtool/db/references.py
index 591af7829..0d63830df 100644
--- a/virtool/db/references.py
+++ b/virtool/db/references.py
@@ -877,7 +877,7 @@ async def finish_remote(app, release, ref_id, created_at, process_id, user_id):
         process_id,
         release["size"],
         factor=0.3,
-        increment=0.1
+        increment=0.03
     )
 
     try:
diff --git a/virtool/db/software.py b/virtool/db/software.py
index b996d9643..17c7565a1 100644
--- a/virtool/db/software.py
+++ b/virtool/db/software.py
@@ -108,6 +108,7 @@ async def install(app, release, process_id):
             process_id,
             release["size"],
             factor=0.5,
+            increment=0.03,
             initial=0
         )
 
diff --git a/virtool/db/users.py b/virtool/db/users.py
index 1d0dd488e..5a6243889 100644
--- a/virtool/db/users.py
+++ b/virtool/db/users.py
@@ -242,14 +242,13 @@ async def edit(db, user_id, administrator=None, force_reset=None, groups=None, p
         "$set": update
     })
 
-    if groups is not None:
-        await update_sessions_and_keys(
-            db,
-            user_id,
-            document["administrator"],
-            groups,
-            document["permissions"]
-        )
+    await update_sessions_and_keys(
+        db,
+        user_id,
+        document["administrator"],
+        document["groups"],
+        document["permissions"]
+    )
 
     return document
 
@@ -318,6 +317,8 @@ async def update_sessions_and_keys(db, user_id, administrator, groups, permissio
         "user.id": user_id
     }
 
+    print(find_query)
+
     async for document in db.keys.find(find_query, ["permissions"]):
         await db.keys.update_one({"_id": document["_id"]}, {
             "$set": {
@@ -327,6 +328,13 @@ async def update_sessions_and_keys(db, user_id, administrator, groups, permissio
             }
         })
 
+    import pprint
+    pprint.pprint({
+        "administrator": administrator,
+        "groups": groups,
+        "permissions": permissions
+    })
+
     await db.sessions.update_many(find_query, {
         "$set": {
             "administrator": administrator,
diff --git a/virtool/organize.py b/virtool/organize.py
index ab5bc8572..2bf3e6f04 100644
--- a/virtool/organize.py
+++ b/virtool/organize.py
@@ -415,7 +415,7 @@ async def organize_subtraction(db):
 async def organize_users(db):
     logger.info(" • users")
 
-    async for document in db.users.find({}, ["groups"]):
+    async for document in db.users.find({"administrator": {"$exists": False}}, ["groups"]):
         await db.users.update_one({"_id": document["_id"]}, {
             "$set": {
                 "administrator": "administrator" in document["groups"]
['virtool/db/software.py', 'virtool/organize.py', 'virtool/db/references.py', 'virtool/db/users.py', 'virtool/db/hmm.py', 'virtool/api/subtractions.py']