fix: correct permission loading for limited organisation

- If a organisation is set to be limited visible, then it will still be
visible for signed-in users. However `UnitPermission` didn't take this
into account, it does now.
- Add unit test.
- Resolves #6141
This commit is contained in:
Gusted 2024-12-04 11:01:05 +01:00
parent 790f3c4861
commit bc9f1e2533
No known key found for this signature in database
GPG key ID: FD821B732837125F
2 changed files with 35 additions and 1 deletions

View file

@ -264,7 +264,7 @@ func (org *Organization) UnitPermission(ctx context.Context, doer *user_model.Us
}
}
if org.Visibility.IsPublic() {
if org.Visibility.IsPublic() || (org.Visibility.IsLimited() && doer != nil) {
return perm.AccessModeRead
}