Live: Move empty orgRole safety valve (#78531)

move empty orgRole safety valve
This commit is contained in:
Jo 2023-11-22 15:51:11 +01:00 committed by GitHub
parent 1910a734a6
commit 40c8e2fc75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,7 +113,12 @@ func (u *SignedInUser) GetCacheKey() string {
if !u.HasUniqueId() { if !u.HasUniqueId() {
// Hack use the org role as id for identities that do not have a unique id // Hack use the org role as id for identities that do not have a unique id
// e.g. anonymous and render key. // 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) 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 // GetOrgRole returns the role of the active entity in the active organization
func (u *SignedInUser) GetOrgRole() roletype.RoleType { func (u *SignedInUser) GetOrgRole() roletype.RoleType {
if u.OrgRole == "" {
return roletype.RoleNone
}
return u.OrgRole return u.OrgRole
} }