File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -529,18 +529,22 @@ type FindOrgOptions struct {
529
529
func (opts FindOrgOptions ) toConds () builder.Cond {
530
530
var cond = builder .NewCond ()
531
531
if opts .UserID > 0 {
532
- cond = cond .And (builder.Eq { "`org_user`.uid" : opts .UserID } )
532
+ cond = cond .And (builder .In ( "`user`.`id`" , queryUserOrgIDs ( opts .UserID )) )
533
533
}
534
534
if ! opts .IncludePrivate {
535
535
cond = cond .And (builder.Eq {"`user`.visibility" : structs .VisibleTypePublic })
536
+ } else {
537
+ cond = cond .And (builder.Eq {"`user`.visibility" : structs .VisibleTypePrivate }.Or (
538
+ builder.Eq {"`user`.visibility" : structs .VisibleTypeLimited },
539
+ ))
536
540
}
537
541
return cond
538
542
}
539
543
540
544
// FindOrgs returns a list of organizations according given conditions
541
545
func FindOrgs (opts FindOrgOptions ) ([]* User , error ) {
542
546
orgs := make ([]* User , 0 , 10 )
543
- sess := db .GetEngine (db .DefaultContext ).Join ( "INNER" , "`org_user`" , "`org_user`.org_id=`user`.id" ).
547
+ sess := db .GetEngine (db .DefaultContext ).
544
548
Where (opts .toConds ()).
545
549
Asc ("`user`.name" )
546
550
if opts .Page > 0 && opts .PageSize > 0 {
You can’t perform that action at this time.
0 commit comments