Auth: Implement requester interface in access control module (#74289)

* Implement requester interface in the access control module
This commit is contained in:
linoman
2023-09-06 11:16:10 +02:00
committed by GitHub
parent 9310bb632e
commit 13f4382214
22 changed files with 179 additions and 114 deletions

View File

@@ -46,11 +46,14 @@ func (u *SignedInUser) NameOrFallback() string {
// TODO: There's a need to remove this struct since it creates a circular dependency
// DEPRECATED: This function uses `UserDisplayDTO` model which we want to remove
// In order to retrieve the user URL, we need the dto library. However, adding
// the dto library to the user service creates a circular dependency
func (u *SignedInUser) ToUserDisplayDTO() *UserDisplayDTO {
return &UserDisplayDTO{
ID: u.UserID,
Login: u.Login,
Name: u.Name,
// AvatarURL: dtos.GetGravatarUrl(u.GetEmail()),
}
}
@@ -200,3 +203,8 @@ func (u *SignedInUser) GetEmail() string {
func (u *SignedInUser) GetDisplayName() string {
return u.NameOrFallback()
}
// DEPRECATEAD: Returns the authentication method used
func (u *SignedInUser) GetAuthenticatedBy() string {
return u.AuthenticatedBy
}

View File

@@ -5,6 +5,8 @@ import (
"fmt"
"strings"
"time"
"github.com/grafana/grafana/pkg/services/auth/identity"
)
type HelpFlags1 uint64
@@ -104,7 +106,7 @@ type SetUsingOrgCommand struct {
}
type SearchUsersQuery struct {
SignedInUser *SignedInUser
SignedInUser identity.Requester
OrgID int64 `xorm:"org_id"`
Query string
Page int