diff options
author | Unknwon <u@gogs.io> | 2015-12-17 02:28:47 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-12-17 02:28:47 -0500 |
commit | 9cd16c5b12d093dd694e146d6c845ee4c405c774 (patch) | |
tree | d9f1a037ba8ecbc3e5fe2f15f0baec6dec6242b4 /models/org.go | |
parent | 6673dcb0380aa99da25b4d1d68cf129635fe30d9 (diff) | |
download | gitea-9cd16c5b12d093dd694e146d6c845ee4c405c774.tar.gz gitea-9cd16c5b12d093dd694e146d6c845ee4c405c774.zip |
#1692 add organization APIs
Diffstat (limited to 'models/org.go')
-rw-r--r-- | models/org.go | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/models/org.go b/models/org.go index 6cc951bef0..fa26b59e66 100644 --- a/models/org.go +++ b/models/org.go @@ -274,10 +274,15 @@ func GetOwnedOrgsByUserIDDesc(userID int64, desc string) ([]*User, error) { return getOwnedOrgsByUserID(sess.Desc(desc), userID) } -// GetOrgUsersByUserId returns all organization-user relations by user ID. -func GetOrgUsersByUserId(uid int64) ([]*OrgUser, error) { +// GetOrgUsersByUserID returns all organization-user relations by user ID. +func GetOrgUsersByUserID(uid int64, all bool) ([]*OrgUser, error) { ous := make([]*OrgUser, 0, 10) - err := x.Where("uid=?", uid).Find(&ous) + sess := x.Where("uid=?", uid) + if !all { + // Only show public organizations + sess.And("is_public=?", true) + } + err := sess.Find(&ous) return ous, err } |