summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-06-15 10:50:12 +0800
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-06-15 04:50:12 +0200
commit31b5e9177f7c0ddcdb97e667f0634fdd13a8d59b (patch)
tree709f6f8e6ee93e706f900d49e94a6e7b7ed1e3ed /models
parent5b0cbf378891b82084b2cbb0e58ea628880f8c95 (diff)
downloadgitea-31b5e9177f7c0ddcdb97e667f0634fdd13a8d59b.tar.gz
gitea-31b5e9177f7c0ddcdb97e667f0634fdd13a8d59b.zip
fix collborators lack of units on orgnization repositories (#1968)
* fix collborators lack of units on orgnization repositories * also change log level to debug
Diffstat (limited to 'models')
-rw-r--r--models/fixtures/repo_unit.yml40
-rw-r--r--models/repo.go7
2 files changed, 47 insertions, 0 deletions
diff --git a/models/fixtures/repo_unit.yml b/models/fixtures/repo_unit.yml
index 5601d65665..daa3480189 100644
--- a/models/fixtures/repo_unit.yml
+++ b/models/fixtures/repo_unit.yml
@@ -37,3 +37,43 @@
index: 0
config: "{}"
created_unix: 946684810
+
+-
+ id: 6
+ repo_id: 3
+ type: 1
+ index: 0
+ config: "{}"
+ created_unix: 946684810
+
+-
+ id: 7
+ repo_id: 3
+ type: 2
+ index: 0
+ config: "{}"
+ created_unix: 946684810
+
+-
+ id: 8
+ repo_id: 3
+ type: 3
+ index: 0
+ config: "{}"
+ created_unix: 946684810
+
+-
+ id: 9
+ repo_id: 3
+ type: 5
+ index: 0
+ config: "{}"
+ created_unix: 946684810
+
+-
+ id: 10
+ repo_id: 3
+ type: 7
+ index: 0
+ config: "{}"
+ created_unix: 946684810
diff --git a/models/repo.go b/models/repo.go
index 8fda3c674d..47d694cdac 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -363,6 +363,13 @@ func (repo *Repository) getUnitsByUserID(e Engine, userID int64, isAdmin bool) (
return nil
}
+ // Collaborators will not be limited
+ if isCollaborator, err := repo.isCollaborator(e, userID); err != nil {
+ return err
+ } else if isCollaborator {
+ return nil
+ }
+
teams, err := getUserTeams(e, repo.OwnerID, userID)
if err != nil {
return err