Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reliable selection of admin user #22509

Merged
merged 2 commits into from
Jan 18, 2023

Commits on Jan 18, 2023

  1. Reliable selection of admin user

    When importing a repository via `gitea restore-repo`, external users will
    get remapped to an admin user. This admin user is obtained via
    `users.GetAdminUser()`, which unfortunately picks a more-or-less random
    admin to return.
    
    This makes it hard to predict which admin user will get assigned. This
    patch orders the admin by ascending ID before choosing the first one, i.e.
    it picks the admin with the lowest ID.
    
    Even though it would be nicer to have full control over which user is
    chosen, this at least gives us a predictable result.
    drsybren committed Jan 18, 2023
    Configuration menu
    Copy the full SHA
    8c946a7 View commit details
    Browse the repository at this point in the history
  2. Change OrderBy("id asc") to Asc("id")

    Thanks @jolheiser for the review & the keen eyes ;-)
    
    Co-authored-by: John Olheiser <john+github@jolheiser.com>
    drsybren and John Olheiser authored Jan 18, 2023
    Configuration menu
    Copy the full SHA
    fd5e228 View commit details
    Browse the repository at this point in the history