gitea user and pswd, some pages removed, logs
This commit is contained in:
@@ -22,6 +22,7 @@ def list_users() -> list[dict[str, Any]]:
|
||||
provider_subject_select = "provider_subject" if "provider_subject" in columns else "NULL AS provider_subject"
|
||||
avatar_url_select = "avatar_url" if "avatar_url" in columns else "NULL AS avatar_url"
|
||||
gitea_user_id_select = "gitea_user_id" if "gitea_user_id" in columns else "NULL AS gitea_user_id"
|
||||
gitea_username_select = "gitea_username" if "gitea_username" in columns else "NULL AS gitea_username"
|
||||
gitea_sync_status_select = "gitea_sync_status" if "gitea_sync_status" in columns else "'not_required' AS gitea_sync_status"
|
||||
gitea_sync_error_select = "gitea_sync_error" if "gitea_sync_error" in columns else "NULL AS gitea_sync_error"
|
||||
gitea_synced_at_select = "gitea_synced_at" if "gitea_synced_at" in columns else "NULL AS gitea_synced_at"
|
||||
@@ -42,6 +43,7 @@ def list_users() -> list[dict[str, Any]]:
|
||||
{provider_subject_select},
|
||||
{avatar_url_select},
|
||||
{gitea_user_id_select},
|
||||
{gitea_username_select},
|
||||
{gitea_sync_status_select},
|
||||
{gitea_sync_error_select},
|
||||
{gitea_synced_at_select}
|
||||
@@ -63,6 +65,7 @@ def get_user(user_id: int) -> dict[str, Any] | None:
|
||||
provider_subject_select = "provider_subject" if "provider_subject" in columns else "NULL AS provider_subject"
|
||||
avatar_url_select = "avatar_url" if "avatar_url" in columns else "NULL AS avatar_url"
|
||||
gitea_user_id_select = "gitea_user_id" if "gitea_user_id" in columns else "NULL AS gitea_user_id"
|
||||
gitea_username_select = "gitea_username" if "gitea_username" in columns else "NULL AS gitea_username"
|
||||
gitea_sync_status_select = "gitea_sync_status" if "gitea_sync_status" in columns else "'not_required' AS gitea_sync_status"
|
||||
gitea_sync_error_select = "gitea_sync_error" if "gitea_sync_error" in columns else "NULL AS gitea_sync_error"
|
||||
gitea_synced_at_select = "gitea_synced_at" if "gitea_synced_at" in columns else "NULL AS gitea_synced_at"
|
||||
@@ -83,6 +86,7 @@ def get_user(user_id: int) -> dict[str, Any] | None:
|
||||
{provider_subject_select},
|
||||
{avatar_url_select},
|
||||
{gitea_user_id_select},
|
||||
{gitea_username_select},
|
||||
{gitea_sync_status_select},
|
||||
{gitea_sync_error_select},
|
||||
{gitea_synced_at_select}
|
||||
@@ -164,6 +168,23 @@ def delete_user(user_id: int) -> None:
|
||||
con.close()
|
||||
|
||||
|
||||
def set_gitea_username(user_id: int, gitea_username: str) -> None:
|
||||
"""Uloží vlastní Gitea uživatelské jméno (handle). Prázdná hodnota = vrácení na automatické portal-{id}."""
|
||||
run_migrations()
|
||||
con = get_connection()
|
||||
con.execute(
|
||||
"""
|
||||
UPDATE users
|
||||
SET gitea_username = ?,
|
||||
updated_at = CURRENT_TIMESTAMP
|
||||
WHERE id = ?
|
||||
""",
|
||||
((gitea_username or "").strip() or None, user_id),
|
||||
)
|
||||
con.commit()
|
||||
con.close()
|
||||
|
||||
|
||||
def update_gitea_sync_state(
|
||||
user_id: int,
|
||||
status: str,
|
||||
|
||||
Reference in New Issue
Block a user