Skip to content

Commit d27f061

Browse files
6543axifive
andauthored
Skip AllowedUserVisibilityModes validation on update user if it is an organisation (#16988) (#16990)
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]> Co-authored-by: Alexey 〒erentyev <[email protected]>
1 parent 07489d0 commit d27f061

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

models/user.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1062,9 +1062,9 @@ func checkDupEmail(e Engine, u *User) error {
10621062
return nil
10631063
}
10641064

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

0 commit comments

Comments
 (0)