From 614382fec0ba05149785539ab93560d4d42c194d Mon Sep 17 00:00:00 2001 From: Joe Chen <jc@unknwon.io> Date: Thu, 2 Feb 2023 21:14:27 +0800 Subject: refactor(db): migrate methods off `user.go` (#7329) --- internal/db/user.go | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'internal/db/user.go') diff --git a/internal/db/user.go b/internal/db/user.go index c2091e6f..50b59630 100644 --- a/internal/db/user.go +++ b/internal/db/user.go @@ -18,7 +18,6 @@ import ( "github.com/gogs/git-module" "gogs.io/gogs/internal/conf" - "gogs.io/gogs/internal/db/errors" "gogs.io/gogs/internal/repoutil" "gogs.io/gogs/internal/userutil" ) @@ -203,17 +202,6 @@ func DeleteInactivateUsers() (err error) { return err } -func GetUserByKeyID(keyID int64) (*User, error) { - user := new(User) - has, err := x.SQL("SELECT a.* FROM `user` AS a, public_key AS b WHERE a.id = b.owner_id AND b.id=?", keyID).Get(user) - if err != nil { - return nil, err - } else if !has { - return nil, errors.UserNotKeyOwner{KeyID: keyID} - } - return user, nil -} - func getUserByID(e Engine, id int64) (*User, error) { u := new(User) has, err := e.ID(id).Get(u) @@ -225,20 +213,6 @@ func getUserByID(e Engine, id int64) (*User, error) { return u, nil } -// GetAssigneeByID returns the user with read access of repository by given ID. -func GetAssigneeByID(repo *Repository, userID int64) (*User, error) { - ctx := context.TODO() - if !Perms.Authorize(ctx, userID, repo.ID, AccessModeRead, - AccessModeOptions{ - OwnerID: repo.OwnerID, - Private: repo.IsPrivate, - }, - ) { - return nil, ErrUserNotExist{args: map[string]interface{}{"userID": userID}} - } - return Users.GetByID(ctx, userID) -} - // GetUserEmailsByNames returns a list of e-mails corresponds to names. func GetUserEmailsByNames(names []string) []string { mails := make([]string, 0, len(names)) -- cgit v1.2.3