diff options
Diffstat (limited to 'internal/db/repo.go')
-rw-r--r-- | internal/db/repo.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/internal/db/repo.go b/internal/db/repo.go index 896c39b8..4d1c3e82 100644 --- a/internal/db/repo.go +++ b/internal/db/repo.go @@ -524,7 +524,20 @@ func (repo *Repository) GetAssignees() (_ []*User, err error) { // GetAssigneeByID returns the user that has write access of repository by given ID. func (repo *Repository) GetAssigneeByID(userID int64) (*User, error) { - return GetAssigneeByID(repo, userID) + ctx := context.TODO() + if !Perms.Authorize( + ctx, + userID, + repo.ID, + AccessModeRead, + AccessModeOptions{ + OwnerID: repo.OwnerID, + Private: repo.IsPrivate, + }, + ) { + return nil, ErrUserNotExist{args: errutil.Args{"userID": userID}} + } + return Users.GetByID(ctx, userID) } // GetWriters returns all users that have write access to the repository. |