diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-12-10 16:14:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 16:14:24 +0800 |
commit | 3ca5dc7e32b372d14ff80d96f14b8f6a805862f1 (patch) | |
tree | 50d193ed0dacf2888d57b193a9b0d36065aff205 /services/user | |
parent | 0a9fcf63a49799ad3b0f146c54879161bac61e10 (diff) | |
download | gitea-3ca5dc7e32b372d14ff80d96f14b8f6a805862f1.tar.gz gitea-3ca5dc7e32b372d14ff80d96f14b8f6a805862f1.zip |
Move keys to models/asymkey (#17917)
* Move keys to models/keys
* Rename models/keys -> models/asymkey
* change the missed package name
* Fix package alias
* Fix test
* Fix docs
* Fix test
* Fix test
* merge
Diffstat (limited to 'services/user')
-rw-r--r-- | services/user/user.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/services/user/user.go b/services/user/user.go index 72052f4ec9..21f1a74f62 100644 --- a/services/user/user.go +++ b/services/user/user.go @@ -14,6 +14,7 @@ import ( "code.gitea.io/gitea/models" admin_model "code.gitea.io/gitea/models/admin" + asymkey_model "code.gitea.io/gitea/models/asymkey" "code.gitea.io/gitea/models/db" repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" @@ -31,11 +32,11 @@ func DeleteUser(u *user_model.User) error { return fmt.Errorf("%s is an organization not a user", u.Name) } - ctx, commiter, err := db.TxContext() + ctx, committer, err := db.TxContext() if err != nil { return err } - defer commiter.Close() + defer committer.Close() // Note: A user owns any repository or belongs to any organization // cannot perform delete operation. @@ -60,14 +61,15 @@ func DeleteUser(u *user_model.User) error { return fmt.Errorf("DeleteUser: %v", err) } - if err := commiter.Commit(); err != nil { + if err := committer.Commit(); err != nil { return err } + committer.Close() - if err = models.RewriteAllPublicKeys(); err != nil { + if err = asymkey_model.RewriteAllPublicKeys(); err != nil { return err } - if err = models.RewriteAllPrincipalKeys(); err != nil { + if err = asymkey_model.RewriteAllPrincipalKeys(); err != nil { return err } |