Admin: paged user list with a dialog; creators manage famous people
CI / test (push) Successful in 1m55s
CI / build (push) Skipped
CI / deploy (push) Skipped

- The user list pages (25 per page, with the total from the backend); roles,
  packages and single units are set in a dialog instead of in the row.
- Creators may add, edit and publish famous people and rewrite their
  portraits (own regenerate route); they delete only their own. The rest of
  the admin stays closed to them; the header links them to their page.
- No free-horoscope offer on the star sign and famous people lists.
- .table-wrap is a containing block, so .sr-only text inside it no longer
  widens the page on phones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-23 09:04:51 +00:00
co-authored by Claude Opus 5.5
parent 26c5bb2746
commit 8d9c50cb02
18 changed files with 541 additions and 217 deletions
+22
View File
@@ -85,6 +85,28 @@ impl FromRequestParts<Arc<AppState>> for AdminUser {
}
}
/// Guard: may manage the famous people (the admin or the creator role).
pub struct CelebrityEditor(pub AuthUser);
impl CelebrityEditor {
pub fn is_admin(&self) -> bool {
self.0.user.has_role(Role::Admin)
}
}
impl FromRequestParts<Arc<AppState>> for CelebrityEditor {
type Rejection = ApiError;
async fn from_request_parts(parts: &mut Parts, state: &Arc<AppState>) -> Result<Self, Self::Rejection> {
let user = AuthUser::from_request_parts(parts, state).await?;
if user.user.has_role(Role::Creator) {
return Ok(CelebrityEditor(user));
}
user.require(Role::Admin)?;
Ok(CelebrityEditor(user))
}
}
pub fn user_agent(parts_headers: &axum::http::HeaderMap) -> Option<String> {
parts_headers.get(USER_AGENT).and_then(|v| v.to_str().ok()).map(|s| s.chars().take(300).collect())
}