MCPcopy Create free account
hub / github.com/gogs/gogs / GetAssigneeByID

Method GetAssigneeByID

internal/database/repo.go:542–557  ·  view source on GitHub ↗

GetAssigneeByID returns the user that has write access of repository by given ID.

(userID int64)

Source from the content-addressed store, hash-verified

540
541// GetAssigneeByID returns the user that has write access of repository by given ID.
542func (r *Repository) GetAssigneeByID(userID int64) (*User, error) {
543 ctx := context.TODO()
544 if !Handle.Permissions().Authorize(
545 ctx,
546 userID,
547 r.ID,
548 AccessModeRead,
549 AccessModeOptions{
550 OwnerID: r.OwnerID,
551 Private: r.IsPrivate,
552 },
553 ) {
554 return nil, ErrUserNotExist{args: errutil.Args{"userID": userID}}
555 }
556 return Handle.Users().GetByID(ctx, userID)
557}
558
559// GetWriters returns all users that have write access to the repository.
560func (r *Repository) GetWriters() (_ []*User, err error) {

Callers 1

ValidateRepoMetasFunction · 0.80

Implementers 2

Repositoryinternal/database/repo.go
mailerRepointernal/database/issue_mail.go

Calls 4

AuthorizeMethod · 0.80
PermissionsMethod · 0.80
UsersMethod · 0.80
GetByIDMethod · 0.65

Tested by

no test coverage detected