Skip to content

Commit

Permalink
Use CheckAccessToAnyResource in the UI
Browse files Browse the repository at this point in the history
Fixes bug where the "Session Recordings" menu doesn't show for users
with where-based roles.
  • Loading branch information
codingllama committed Dec 17, 2021
1 parent f437ca9 commit e944b86
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/web/ui/usercontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit e944b86

Please sign in to comment.