Skip to content

Commit 8e18b41

Browse files
6543axifive
andauthored
Skip AllowedUserVisibilityModes validation on update user if it is an organisation (#16988)
if AllowedUserVisibilityModes allow only public & limited, and orgs can be private, a user can create a repo to that organisation whitch will result in an update of the user. On this call the user is validaten and will be rejected since private is not allowed, but its not an user its an valid org ... Co-authored-by: Alexey 〒erentyev <[email protected]>
1 parent ddc709f commit 8e18b41

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

models/user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,9 +1060,9 @@ func checkDupEmail(e Engine, u *User) error {
10601060
return nil
10611061
}
10621062

1063-
// validateUser check if user is valide to insert / update into database
1063+
// validateUser check if user is valid to insert / update into database
10641064
func validateUser(u *User) error {
1065-
if !setting.Service.AllowedUserVisibilityModesSlice.IsAllowedVisibility(u.Visibility) {
1065+
if !setting.Service.AllowedUserVisibilityModesSlice.IsAllowedVisibility(u.Visibility) && !u.IsOrganization() {
10661066
return fmt.Errorf("visibility Mode not allowed: %s", u.Visibility.String())
10671067
}
10681068

0 commit comments

Comments
 (0)