feat: assign users to teams via OIDC claims #1393
|
@ -131,17 +131,18 @@ func GetTeamByID(s *xorm.Session, id int64) (team *Team, err error) {
|
|||
|
||||
// GetTeamByOidcIDAndName gets teams where oidc_id and name match parameters
|
||||
// For oidc team creation oidcID and Name need to be set
|
||||
func GetTeamByOidcIDAndName(s *xorm.Session, oidcID string, teamName string) (team Team, err error) {
|
||||
func GetTeamByOidcIDAndName(s *xorm.Session, oidcID string, teamName string) (*Team, error) {
|
||||
viehlieb marked this conversation as resolved
Outdated
|
||||
team := &Team{}
|
||||
has, err := s.
|
||||
Table("teams").
|
||||
Where("oidc_id = ? AND name = ?", oidcID, teamName).
|
||||
Asc("id").
|
||||
konrad marked this conversation as resolved
Outdated
konrad
commented
Did you try passing the Did you try passing the
viehlieb
commented
Ups, I guess here is something missing Ups, I guess here is something missing
|
||||
Limit(1).
|
||||
Get(&team)
|
||||
Get(team)
|
||||
viehlieb marked this conversation as resolved
Outdated
konrad
commented
`Get` will always return one entry, no need for `Asc` or `Limit`.
|
||||
if !has || err != nil {
|
||||
return team, ErrOIDCTeamDoesNotExist{teamName, oidcID}
|
||||
return nil, ErrOIDCTeamDoesNotExist{teamName, oidcID}
|
||||
}
|
||||
return team, err
|
||||
return team, nil
|
||||
}
|
||||
|
||||
func FindAllOidcTeamIDsForUser(s *xorm.Session, userID int64) (ts []int64, err error) {
|
||||
|
|
Loading…
Reference in New Issue
Please return a pointer to a
team i suppose.done, tx