From 2342df183b64794db74f399759f16c71e2dd543e Mon Sep 17 00:00:00 2001 From: Ethan Koenig Date: Mon, 26 Dec 2016 02:37:01 -0500 Subject: API Endpoints for collaborators (#375) --- models/repo_collaboration.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'models') diff --git a/models/repo_collaboration.go b/models/repo_collaboration.go index 308f57b7d2..39df5b9efa 100644 --- a/models/repo_collaboration.go +++ b/models/repo_collaboration.go @@ -103,6 +103,15 @@ func (repo *Repository) GetCollaborators() ([]*Collaborator, error) { return repo.getCollaborators(x) } +func (repo *Repository) isCollaborator(e Engine, userID int64) (bool, error) { + return e.Get(&Collaboration{RepoID: repo.ID, UserID: userID}) +} + +// IsCollaborator check if a user is a collaborator of a repository +func (repo *Repository) IsCollaborator(userID int64) (bool, error) { + return repo.isCollaborator(x, userID) +} + // ChangeCollaborationAccessMode sets new access mode for the collaboration. func (repo *Repository) ChangeCollaborationAccessMode(uid int64, mode AccessMode) error { // Discard invalid input -- cgit v1.2.3