diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-04-26 02:59:10 +0800 |
---|---|---|
committer | Lauris BH <lauris@nix.lv> | 2019-04-25 21:59:10 +0300 |
commit | 199faadea3ff40880d70c8bc031aab800720330d (patch) | |
tree | 274117bd848e3cbf9c7f9fb3057814fd76552e83 /models/org.go | |
parent | e8f4c7733a822eb6bb04909dbf70f2de679522b7 (diff) | |
download | gitea-199faadea3ff40880d70c8bc031aab800720330d.tar.gz gitea-199faadea3ff40880d70c8bc031aab800720330d.zip |
Fix org visibility bug when git cloning (#6743)
* fix org visibility bug
* fix permission check
* add integration tests
* fix tests
* change test user name for easier maintainance and fix test
* fix test git repo name
Diffstat (limited to 'models/org.go')
-rw-r--r-- | models/org.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/models/org.go b/models/org.go index 149d6f7aa7..b7db32ef16 100644 --- a/models/org.go +++ b/models/org.go @@ -370,6 +370,10 @@ func getOwnedOrgsByUserID(sess *xorm.Session, userID int64) ([]*User, error) { // HasOrgVisible tells if the given user can see the given org func HasOrgVisible(org *User, user *User) bool { + return hasOrgVisible(x, org, user) +} + +func hasOrgVisible(e Engine, org *User, user *User) bool { // Not SignedUser if user == nil { if org.Visibility == structs.VisibleTypePublic { @@ -382,7 +386,7 @@ func HasOrgVisible(org *User, user *User) bool { return true } - if org.Visibility == structs.VisibleTypePrivate && !org.IsUserPartOfOrg(user.ID) { + if org.Visibility == structs.VisibleTypePrivate && !org.isUserPartOfOrg(e, user.ID) { return false } return true |