[v11.4.x] OAuth: Return SocialError on membership check failure (#98861)

OAuth: Return SocialError on membership check failure (#98330)

use socialerror

(cherry picked from commit ddca09fb02)

Co-authored-by: Daniel-Davies <33356828+Daniel-Davies@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot]
2025-01-13 12:18:49 +02:00
committed by GitHub
co-authored by Daniel-Davies
parent dc2c257c1a
commit 227c8392e0
+2 -3
View File
@@ -4,7 +4,6 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/mail"
@@ -320,11 +319,11 @@ func (s *SocialGenericOAuth) UserInfo(ctx context.Context, client *http.Client,
}
if !s.isTeamMember(ctx, client) {
return nil, errors.New("user not a member of one of the required teams")
return nil, &SocialError{"User not a member of one of the required teams"}
}
if !s.isOrganizationMember(ctx, client) {
return nil, errors.New("user not a member of one of the required organizations")
return nil, &SocialError{"User not a member of one of the required organizations"}
}
if !s.isGroupMember(userInfo.Groups) {