diff options
author | zeripath <art27@cantab.net> | 2020-03-29 15:31:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-29 15:31:10 +0100 |
commit | 209045f55b1cfdb6e52fa7a67078c1a4edb1cf4f (patch) | |
tree | b3a2801fda6ce1efeb6280fdcb157ccba5b507cf /models | |
parent | ad4026431b155cb7007bd7b0eaecc33a792efe0b (diff) | |
download | gitea-209045f55b1cfdb6e52fa7a67078c1a4edb1cf4f.tar.gz gitea-209045f55b1cfdb6e52fa7a67078c1a4edb1cf4f.zip |
Slight simplification of accessibleRepositoryCondition (#10875)
* Slight simplification of accessibleRepositoryCondition
Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'models')
-rw-r--r-- | models/repo_list.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/models/repo_list.go b/models/repo_list.go index 9c5597ee09..7ceb88f088 100644 --- a/models/repo_list.go +++ b/models/repo_list.go @@ -353,11 +353,12 @@ func accessibleRepositoryCondition(user *User) builder.Cond { // 1. Be able to see all non-private repositories that either: cond = cond.Or(builder.And( builder.Eq{"`repository`.is_private": false}, - builder.Or( - // A. Aren't in organisations __OR__ - builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where(builder.Eq{"type": UserTypeOrganization})), - // B. Isn't a private organisation. Limited is OK as long as we're logged in. - builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where(builder.In("visibility", orgVisibilityLimit)))))) + // 2. Aren't in an private organisation or limited organisation if we're not logged in + builder.NotIn("`repository`.owner_id", builder.Select("id").From("`user`").Where( + builder.And( + builder.Eq{"type": UserTypeOrganization}, + builder.In("visibility", orgVisibilityLimit)), + )))) } if user != nil { |