refactor: list_user_roles uses _row_to_dict instead of positional row mapping

This commit is contained in:
Patrick Buckley
2026-03-11 21:14:58 -07:00
parent 7960784786
commit 648ba477e1
2 changed files with 2 additions and 30 deletions
+1 -15
View File
@@ -1363,21 +1363,7 @@ class PostgreSQLBackend:
.select_from(user_roles.join(roles, user_roles.c.role_id == roles.c.role_id))
.where(user_roles.c.user_id == user_id)
).fetchall()
return [
{
"role_id": r[0],
"name": r[1],
"display_name": r[2],
"permissions": r[3],
"builtin": bool(r[4]),
"org_id": r[5],
"created": r[6],
"updated": r[7],
"assigned_by": r[8],
"assignment_created": r[9],
}
for r in rows
]
return [_row_to_dict(r, "builtin") for r in rows]
def get_user_permissions(self, user_id: str) -> set[str]:
with self._engine.connect() as conn:
+1 -15
View File
@@ -1401,21 +1401,7 @@ class SQLiteBackend:
.select_from(user_roles.join(roles, user_roles.c.role_id == roles.c.role_id))
.where(user_roles.c.user_id == user_id)
).fetchall()
return [
{
"role_id": r[0],
"name": r[1],
"display_name": r[2],
"permissions": r[3],
"builtin": bool(r[4]),
"org_id": r[5],
"created": r[6],
"updated": r[7],
"assigned_by": r[8],
"assignment_created": r[9],
}
for r in rows
]
return [_row_to_dict(r, "builtin") for r in rows]
def get_user_permissions(self, user_id: str) -> set[str]:
with self._engine.connect() as conn: