feat: assign users to teams via OIDC claims #1393

Merged
konrad merged 93 commits from viehlieb/api:950_reworked_assign_teams_via_oidc into main 2024-03-02 08:47:12 +00:00
Showing only changes of commit ac032400d6 - Show all commits

View File

@ -228,6 +228,7 @@ func HandleCallback(c echo.Context) error {
log.Errorf("Found Error while signing out from teams %v", err)
}
}
err = s.Commit()
viehlieb marked this conversation as resolved Outdated

Replace with

if len(teamData) < 1 {
	return
}
Replace with ``` if len(teamData) < 1 { return }

It could well be, that only a single team is received through the oidc token.

It could well be, that only a single team is received through the oidc token.

But len(teamData) < 1 will only be true if there are 0 teams received?

I should have phrased it better, this is equivalent:

if len(teamData) == 0 {
	return
}
But `len(teamData) < 1` will only be true if there are 0 teams received? I should have phrased it better, this is equivalent: ``` if len(teamData) == 0 { return } ```

yes, that's true of course. i do not know why i read it differently.

yes, that's true of course. i do not know why i read it differently.
if err != nil {
viehlieb marked this conversation as resolved Outdated

This should be an Error log message.

This should be an `Error` log message.
_ = s.Rollback()
@ -347,7 +348,9 @@ func GetOrCreateTeamsByOIDCAndNames(s *xorm.Session, teamData []models.OIDCTeamD
log.Debugf("Team with oidc_id %v and name %v already exists.", team.OidcID, team.Name)
te = append(te, &team)
}
}
log.Debugf("Array: %v", te)
return te, err
}