mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Fix org visibility bug when git cloning (#6743)
* fix org visibility bug * fix permission check * add integration tests * fix tests * change test user name for easier maintainance and fix test * fix test git repo name
This commit is contained in:
parent
e8f4c7733a
commit
199faadea3
87 changed files with 2865 additions and 14 deletions
|
@ -370,6 +370,10 @@ func getOwnedOrgsByUserID(sess *xorm.Session, userID int64) ([]*User, error) {
|
|||
|
||||
// HasOrgVisible tells if the given user can see the given org
|
||||
func HasOrgVisible(org *User, user *User) bool {
|
||||
return hasOrgVisible(x, org, user)
|
||||
}
|
||||
|
||||
func hasOrgVisible(e Engine, org *User, user *User) bool {
|
||||
// Not SignedUser
|
||||
if user == nil {
|
||||
if org.Visibility == structs.VisibleTypePublic {
|
||||
|
@ -382,7 +386,7 @@ func HasOrgVisible(org *User, user *User) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
if org.Visibility == structs.VisibleTypePrivate && !org.IsUserPartOfOrg(user.ID) {
|
||||
if org.Visibility == structs.VisibleTypePrivate && !org.isUserPartOfOrg(e, user.ID) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue