feat: check application existence in object.AddUser() (#3686)

This commit is contained in:
WindSpiritSR
2025-04-05 16:38:20 +08:00
committed by GitHub
parent 18bb445e71
commit 952538916d
3 changed files with 28 additions and 8 deletions

View File

@ -834,6 +834,16 @@ func AddUser(user *User) (bool, error) {
return false, fmt.Errorf("the organization: %s is not found", user.Owner)
}
if user.Owner != "built-in" {
applicationCount, err := GetOrganizationApplicationCount(organization.Owner, organization.Name, "", "")
if err != nil {
return false, err
}
if applicationCount == 0 {
return false, fmt.Errorf("The organization: %s should have one application at least", organization.Owner)
}
}
if organization.DefaultPassword != "" && user.Password == "123" {
user.Password = organization.DefaultPassword
}