Chore: Enable exhaustive linter (#29458)
* Chore: Enable exhaustive linter Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -232,7 +232,6 @@ func verifyExistingOrg(sess *DBSession, orgId int64) error {
|
||||
|
||||
func getOrCreateOrg(sess *DBSession, orgName string) (int64, error) {
|
||||
var org models.Org
|
||||
|
||||
if setting.AutoAssignOrg {
|
||||
has, err := sess.Where("id=?", setting.AutoAssignOrgId).Get(&org)
|
||||
if err != nil {
|
||||
@@ -241,15 +240,16 @@ func getOrCreateOrg(sess *DBSession, orgName string) (int64, error) {
|
||||
if has {
|
||||
return org.Id, nil
|
||||
}
|
||||
if setting.AutoAssignOrgId == 1 {
|
||||
org.Name = mainOrgName
|
||||
org.Id = int64(setting.AutoAssignOrgId)
|
||||
} else {
|
||||
|
||||
if setting.AutoAssignOrgId != 1 {
|
||||
sqlog.Error("Could not create user: organization ID does not exist", "orgID",
|
||||
setting.AutoAssignOrgId)
|
||||
return 0, fmt.Errorf("could not create user: organization ID %d does not exist",
|
||||
setting.AutoAssignOrgId)
|
||||
}
|
||||
|
||||
org.Name = mainOrgName
|
||||
org.Id = int64(setting.AutoAssignOrgId)
|
||||
} else {
|
||||
org.Name = orgName
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user