fix(admin): offer --purge for users who own repositories and show roles

admin user delete of a user who owns repositories failed with Gitea's raw
HTTP 422. The error now says what blocks the deletion and how to proceed,
and --purge deletes the account with its repositories, packages and
organization memberships after typing the username on a terminal.

admin user list shows ROLE and STATUS columns (admin, restricted, user;
active, inactive, login prohibited) with the email and creation date
instead of admin=true/active=true cells, and --query filters by username,
name or email. admin user view shows the account instead of its list
row. create asks for a missing username and email address with readable
labels and re-asks for invalid answers, mutations print ✓ lines, usernames
complete, and every command has examples.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-11 23:42:49 +02:00
1 parent ef8cfbc4b7
commit c18dae6685
6 files changed
+465 -195

No files matched your search

+2 -2
View File
@@ -20,13 +20,13 @@ func TestUsageErrorsPrecedeRequests(t *testing.T) {
args []string
want string
}{
{[]string{"admin", "user", "create", "account", "--email", "invalid", "--password", "local-password"}, "--email must contain one email address"},
{[]string{"admin", "user", "create", "account", "--email", "invalid", "--password", "local-password"}, "--email: enter one email address"},
{[]string{"admin", "user", "create", "account", "--email", "account@example.test", "--password", "one", "--password-file", "-"}, "--password and --password-file are mutually exclusive"},
{[]string{"admin", "user", "create", "account", "--email", "account@example.test", "--password-file", ""}, "--password-file must name a file or -"},
{[]string{"admin", "user", "create", "account", "--email", "account@example.test", "--password", "local-password", "--visibility", "invalid"}, "--visibility must be public, limited, or private"},
{[]string{"admin", "user", "create", "account", "--username", "different"}, "supply username as an argument or --username, not both"},
{[]string{"admin", "user", "edit", "account"}, "supply account fields to edit"},
{[]string{"admin", "user", "edit", "account", "--email="}, "--email must contain one email address"},
{[]string{"admin", "user", "edit", "account", "--email="}, "--email: enter one email address"},
{[]string{"admin", "user", "edit", "account", "--max-repo-creation", "-2"}, "--max-repo-creation must be -1 or nonnegative"},
{[]string{"admin", "user", "edit", "account", "--password="}, "missing password: supply --password-file or --password"},
{[]string{"admin", "user", "view", "bad/account"}, "invalid account username"},