Fix bug preventing transfer to private organization (#12497)

* Fix bug preventing transfer to private organization

The code assessing whether a private organization was visible to a user before
allowing transfer was incorrect due to testing membership the wrong way round

This PR fixes this issue and renames the function performing the test to be
clearer.

Further looking at the API for transfer repository - no testing was
performed to ensure that the acting user could actually see the new
owning organization.

Signed-off-by: Andrew Thornton <art27@cantab.net>

* change IsUserPartOfOrg everywhere
This commit is contained in:
zeripath
2020-08-16 21:27:08 +01:00
committed by GitHub
parent f50364a5b0
commit d1e67d7ade
6 changed files with 19 additions and 10 deletions

View File

@ -435,7 +435,7 @@ func hasOrgVisible(e Engine, org *User, user *User) bool {
return true
}
if (org.Visibility == structs.VisibleTypePrivate || user.IsRestricted) && !org.isUserPartOfOrg(e, user.ID) {
if (org.Visibility == structs.VisibleTypePrivate || user.IsRestricted) && !org.hasMemberWithUserID(e, user.ID) {
return false
}
return true