From 40c8e2fc75b4ac193995392a80297f355aad9d77 Mon Sep 17 00:00:00 2001 From: Jo Date: Wed, 22 Nov 2023 15:51:11 +0100 Subject: [PATCH] Live: Move empty orgRole safety valve (#78531) move empty orgRole safety valve --- pkg/services/user/identity.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/services/user/identity.go b/pkg/services/user/identity.go index 776c9775b1c..49b4edc2c8c 100644 --- a/pkg/services/user/identity.go +++ b/pkg/services/user/identity.go @@ -113,7 +113,12 @@ func (u *SignedInUser) GetCacheKey() string { if !u.HasUniqueId() { // Hack use the org role as id for identities that do not have a unique id // e.g. anonymous and render key. - id = string(u.GetOrgRole()) + orgRole := u.GetOrgRole() + if orgRole == "" { + orgRole = roletype.RoleNone + } + + id = string(orgRole) } return fmt.Sprintf("%d-%s-%s", u.GetOrgID(), namespace, id) @@ -162,9 +167,6 @@ func (u *SignedInUser) GetTeams() []int64 { // GetOrgRole returns the role of the active entity in the active organization func (u *SignedInUser) GetOrgRole() roletype.RoleType { - if u.OrgRole == "" { - return roletype.RoleNone - } return u.OrgRole }