SCIM: Add a distinctive label for externally provisioned users (#102701)

* Add json mapping for user.isProvisioned

* Retrieve the isProvisioned value from database

* Add a Provisioned label to pages that list users

* Update swagger definitions

* Add changes to User Admin pages
This commit is contained in:
linoman
2025-03-25 10:06:45 +01:00
committed by GitHub
parent 77fa2271be
commit 874e98a488
13 changed files with 67 additions and 8 deletions
+1
View File
@@ -157,6 +157,7 @@ type OrgUserDTO struct {
IsDisabled bool `json:"isDisabled"`
AuthLabels []string `json:"authLabels" xorm:"-"`
IsExternallySynced bool `json:"isExternallySynced"`
IsProvisioned bool `json:"isProvisioned"`
}
type RemoveOrgUserCommand struct {
+1
View File
@@ -611,6 +611,7 @@ func (ss *sqlStore) SearchOrgUsers(ctx context.Context, query *org.SearchOrgUser
"u.created",
"u.updated",
"u.is_disabled",
"u.is_provisioned",
)
if len(query.SortOpts) > 0 {
+2 -2
View File
@@ -137,11 +137,11 @@ type UserSearchHitDTO struct {
AvatarURL string `json:"avatarUrl" xorm:"avatar_url"`
IsAdmin bool `json:"isAdmin"`
IsDisabled bool `json:"isDisabled"`
IsProvisioned bool `json:"isProvisioned"`
LastSeenAt time.Time `json:"lastSeenAt"`
LastSeenAtAge string `json:"lastSeenAtAge"`
AuthLabels []string `json:"authLabels"`
AuthModule AuthModuleConversion `json:"-"`
IsProvisioned bool `json:"-" xorm:"is_provisioned"`
}
type GetUserProfileQuery struct {
@@ -166,7 +166,7 @@ type UserProfileDTO struct {
CreatedAt time.Time `json:"createdAt"`
AvatarURL string `json:"avatarUrl"`
AccessControl map[string]bool `json:"accessControl,omitempty"`
IsProvisioned bool `json:"-"`
IsProvisioned bool `json:"isProvisioned"`
}
// implement Conversion interface to define custom field mapping (xorm feature)
+2 -1
View File
@@ -374,6 +374,7 @@ func (ss *sqlStore) GetProfile(ctx context.Context, query *user.GetUserProfileQu
Theme: usr.Theme,
IsGrafanaAdmin: usr.IsAdmin,
IsDisabled: usr.IsDisabled,
IsProvisioned: usr.IsProvisioned,
OrgID: usr.OrgID,
UpdatedAt: usr.Updated,
CreatedAt: usr.Created,
@@ -526,7 +527,7 @@ func (ss *sqlStore) Search(ctx context.Context, query *user.SearchUsersQuery) (*
sess.Limit(query.Limit, offset)
}
sess.Cols("u.id", "u.uid", "u.email", "u.name", "u.login", "u.is_admin", "u.is_disabled", "u.last_seen_at", "user_auth.auth_module")
sess.Cols("u.id", "u.uid", "u.email", "u.name", "u.login", "u.is_admin", "u.is_disabled", "u.last_seen_at", "user_auth.auth_module", "u.is_provisioned")
if len(query.SortOpts) > 0 {
for i := range query.SortOpts {