Skip to content

Commit

Permalink
Skip AllowedUserVisibilityModes validation on update user if it is an…
Browse files Browse the repository at this point in the history
… organisation (go-gitea#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]>
  • Loading branch information
6543 and axifive authored Sep 8, 2021
1 parent ddc709f commit 8e18b41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,9 +1060,9 @@ func checkDupEmail(e Engine, u *User) error {
return nil
}

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

Expand Down

0 comments on commit 8e18b41

Please sign in to comment.