(user_id: str, item_type: str, value: str, action: str)
| 1814 | except Exception: |
| 1815 | pass |
| 1816 | |
| 1817 | conn = db_ops.get_connection() |
| 1818 | rows = conn.execute( |
| 1819 | """ |
| 1820 | SELECT user_id, updated_at |
| 1821 | FROM profiles |
| 1822 | ORDER BY updated_at DESC, user_id ASC |
| 1823 | """ |
| 1824 | ).fetchall() |
| 1825 | conn.close() |
| 1826 | |
| 1827 | for row in rows: |
| 1828 | user_id = str(row["user_id"]) |
| 1829 | item = users.setdefault( |
| 1830 | user_id, |
| 1831 | { |
| 1832 | "user_id": user_id, |
| 1833 | "role_name": "", |
| 1834 | "description": "", |
| 1835 | "is_current": False, |
| 1836 | "source": "profiles", |
| 1837 | }, |
| 1838 | ) |
| 1839 | item["updated_at"] = row["updated_at"] |
| 1840 | item["has_profile"] = True |
| 1841 | |
| 1842 | return {"users": list(users.values())} |
| 1843 | |
| 1844 | |
| 1845 | def list_roles() -> Dict[str, Any]: |
| 1846 | """Return role metadata in a GUI-friendly shape.""" |
| 1847 | try: |
| 1848 | result = role_manager.list_roles() |
| 1849 | except Exception as exc: |
| 1850 | return {"roles": [], "current_role": None, "error": str(exc)} |
| 1851 | roles = [] |
| 1852 | for role in result.get("roles") or []: |
| 1853 | roles.append( |
| 1854 | { |
| 1855 | "name": role.get("name"), |
nothing calls this directly
no test coverage detected