From 030bfb14f2bd56f4a5d05942bb8c6d2cec01ca0a Mon Sep 17 00:00:00 2001 From: Alan Parra Date: Fri, 17 Dec 2021 15:21:53 -0300 Subject: [PATCH] Use CheckAccessToAnyResource in the UI Fixes bug where the "Session Recordings" menu doesn't show for users with where-based roles. --- lib/web/ui/usercontext.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/web/ui/usercontext.go b/lib/web/ui/usercontext.go index 8a99c0690e034..d6cba6c9aa9f2 100644 --- a/lib/web/ui/usercontext.go +++ b/lib/web/ui/usercontext.go @@ -149,14 +149,12 @@ func getWindowsDesktopLogins(roleSet services.RoleSet) []string { func hasAccess(roleSet services.RoleSet, ctx *services.Context, kind string, verbs ...string) bool { for _, verb := range verbs { - // Since this check occurs often and it does not imply the caller is trying - // to access any resource, silence any logging done on the proxy. - err := roleSet.CheckAccessToRule(ctx, apidefaults.Namespace, kind, verb, true) - if err != nil { + // Since this check occurs often and does not imply the caller is trying to + // access any resource, silence any logging done on the proxy. + if err := roleSet.CheckAccessToAnyResource(ctx, apidefaults.Namespace, kind, verb, true); err != nil { return false } } - return true }