aboutsummaryrefslogtreecommitdiff
path: root/internal/db/user.go
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2023-02-02 21:14:27 +0800
committerGitHub <noreply@github.com>2023-02-02 21:14:27 +0800
commit614382fec0ba05149785539ab93560d4d42c194d (patch)
tree50037ddd412606cfadb278a9c9ea7c4a1eb3d4cc /internal/db/user.go
parent9df10cb8cc84fbeba9eb603c458078f132a6c201 (diff)
refactor(db): migrate methods off `user.go` (#7329)
Diffstat (limited to 'internal/db/user.go')
-rw-r--r--internal/db/user.go26
1 files changed, 0 insertions, 26 deletions
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))