diff options
author | Ethan Koenig <etk39@cornell.edu> | 2016-12-26 02:37:01 -0500 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2016-12-26 15:37:01 +0800 |
commit | 2342df183b64794db74f399759f16c71e2dd543e (patch) | |
tree | 7eab277138bcea5e6f432222d98a72cffa135f3a /models | |
parent | 2e7ccecfe6f3d52b1dd5277a0eaf7a628164c8ac (diff) | |
download | gitea-2342df183b64794db74f399759f16c71e2dd543e.tar.gz gitea-2342df183b64794db74f399759f16c71e2dd543e.zip |
API Endpoints for collaborators (#375)
Diffstat (limited to 'models')
-rw-r--r-- | models/repo_collaboration.go | 9 |
1 files changed, 9 insertions, 0 deletions
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 |