summaryrefslogtreecommitdiffstats
path: root/models/org.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-17 02:28:47 -0500
committerUnknwon <u@gogs.io>2015-12-17 02:28:47 -0500
commit9cd16c5b12d093dd694e146d6c845ee4c405c774 (patch)
treed9f1a037ba8ecbc3e5fe2f15f0baec6dec6242b4 /models/org.go
parent6673dcb0380aa99da25b4d1d68cf129635fe30d9 (diff)
downloadgitea-9cd16c5b12d093dd694e146d6c845ee4c405c774.tar.gz
gitea-9cd16c5b12d093dd694e146d6c845ee4c405c774.zip
#1692 add organization APIs
Diffstat (limited to 'models/org.go')
-rw-r--r--models/org.go11
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
}