Skip to content

Commit a3e5231

Browse files
KN4CK3Rlafriks
andcommitted
Do not allow Ghost access to limited visible user/org (go-gitea#21849)
The Ghost user should not be allowed to have access to a limited visible user/org. Co-authored-by: Lauris BH <lauris@nix.lv>
1 parent 56716f5 commit a3e5231

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

models/organization/org.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,9 @@ func CountOrgs(opts FindOrgOptions) (int64, error) {
448448

449449
// HasOrgOrUserVisible tells if the given user can see the given org or user
450450
func HasOrgOrUserVisible(ctx context.Context, orgOrUser, user *user_model.User) bool {
451-
// Not SignedUser
452-
if user == nil {
451+
// If user is nil, it's an anonymous user/request.
452+
// The Ghost user is handled like an anonymous user.
453+
if user == nil || user.IsGhost() {
453454
return orgOrUser.Visibility == structs.VisibleTypePublic
454455
}
455456

0 commit comments

Comments
 (0)