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 696cc951fa - Show all commits

View File

@ -82,7 +82,7 @@ type TeamMember struct {
}
// TableName makes beautiful table names
func (TeamMember) TableName() string {
func (*TeamMember) TableName() string {
viehlieb marked this conversation as resolved Outdated

Why did you change this?

Why did you change this?

oha.
this was unintended.

oha. this was unintended.
return "team_members"
}
@ -167,7 +167,7 @@ func FindAllOidcTeamIDsForUser(s *xorm.Session, userID int64) (ts []int64, err e
Table("team_members").
Where("user_id = ? ", userID).
Join("RIGHT", "teams", "teams.id = team_members.team_id").
viehlieb marked this conversation as resolved Outdated

Can teams.oidc_id be null? Then you should check that as well.

Can `teams.oidc_id` be null? Then you should check that as well.
Where("teams.oidc_id != ?", "").
Where("teams.oidc_id != ? AND teams.oidc_id IS NOT NULL", "").
Cols("teams.id").
Find(&ts)
if ts == nil || err != nil {
@ -366,11 +366,6 @@ func (t *Team) Create(s *xorm.Session, a web.Auth) (err error) {
})
}
func (t *Team) ManageAdminRight(teamMember TeamMember, admin bool) {
// Insert the current user as member and admin
teamMember.Admin = admin
}
// Delete deletes a team
// @Summary Deletes a team
// @Description Delets a team. This will also remove the access for all users in that team.