remove user from all oidc teams if token is empty
This commit is contained in:
parent
b32656c46f
commit
2eb0bb9c14
|
@ -212,15 +212,12 @@ func HandleCallback(c echo.Context) error {
|
|||
return handler.HandleHTTPError(err, c)
|
||||
}
|
||||
|
||||
//TODO: fix this error check
|
||||
// nil is no problem
|
||||
|
||||
//find old teams for user through oidc
|
||||
oldOidcTeams, _ := models.FindAllOidcTeamIDsForUser(s, u.ID)
|
||||
var oidcTeams []int64
|
||||
if len(teamData) > 0 {
|
||||
//find old teams for user through oidc
|
||||
oldOidcTeams, _ := models.FindAllOidcTeamIDsForUser(s, u.ID)
|
||||
// check if we have seen these teams before.
|
||||
// find or create Teams and assign user as teammember.
|
||||
var oidcTeams []int64
|
||||
log.Debugf("TeamData is set %v", teamData)
|
||||
teams, err := GetOrCreateTeamsByOIDCAndNames(s, teamData, u)
|
||||
if err != nil {
|
||||
|
@ -240,8 +237,8 @@ func HandleCallback(c echo.Context) error {
|
|||
}
|
||||
oidcTeams = append(oidcTeams, team.ID)
|
||||
}
|
||||
SignOutFromOrDeleteTeamsByID(s, u, notIn(oldOidcTeams, oidcTeams))
|
||||
}
|
||||
SignOutFromOrDeleteTeamsByID(s, u, notIn(oldOidcTeams, oidcTeams))
|
||||
err = s.Commit()
|
||||
if err != nil {
|
||||
_ = s.Rollback()
|
||||
|
@ -343,12 +340,6 @@ func GetOrCreateTeamsByOIDCAndNames(s *xorm.Session, teamData []TeamData, u *use
|
|||
return te, err
|
||||
}
|
||||
|
||||
// assign user to team
|
||||
// remove user from team if not in group
|
||||
// if multiple teams found with same name -> do nothing
|
||||
// optional: assign by id
|
||||
//
|
||||
|
||||
func getOrCreateUser(s *xorm.Session, cl *claims, issuer, subject string) (u *user.User, err error) {
|
||||
|
||||
// Check if the user exists for that issuer and subject
|
||||
|
|
Loading…
Reference in New Issue