IsCollaborator returns true if the user is a collaborator of the repository.
(repoID, userID int64)
| 30 | |
| 31 | // IsCollaborator returns true if the user is a collaborator of the repository. |
| 32 | func IsCollaborator(repoID, userID int64) bool { |
| 33 | collaboration := &Collaboration{ |
| 34 | RepoID: repoID, |
| 35 | UserID: userID, |
| 36 | } |
| 37 | has, err := x.Get(collaboration) |
| 38 | if err != nil { |
| 39 | log.Error("get collaboration [repo_id: %d, user_id: %d]: %v", repoID, userID, err) |
| 40 | return false |
| 41 | } |
| 42 | return has |
| 43 | } |
| 44 | |
| 45 | func (r *Repository) IsCollaborator(userID int64) bool { |
| 46 | return IsCollaborator(r.ID, userID) |
no test coverage detected