summaryrefslogtreecommitdiffstats
path: root/models/user.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-09-08 17:47:49 +0200
committerGitHub <noreply@github.com>2021-09-08 17:47:49 +0200
commit8e18b412c302e90e7a69e27050e6f86c4cf26d1d (patch)
tree99374788e97d912f35d3dafec26a83b46f81b9e4 /models/user.go
parentddc709ff7f94bd627ac05209a16ea5a5e24b7413 (diff)
downloadgitea-8e18b412c302e90e7a69e27050e6f86c4cf26d1d.tar.gz
gitea-8e18b412c302e90e7a69e27050e6f86c4cf26d1d.zip
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 <axifnx@gmail.com>
Diffstat (limited to 'models/user.go')
-rw-r--r--models/user.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/models/user.go b/models/user.go
index a2d185de39..92452e0767 100644
--- a/models/user.go
+++ b/models/user.go
@@ -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())
}