From 6e50d1166a2c66c48afdccfdc4b9ae5fe0fcc3eb Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Tue, 15 Jun 2021 16:38:37 +0200 Subject: [PATCH] Only attempt to get "trace/contexts" if admin (#9378) * Only attempt to get "trace/contexts" if admin * Changes from review --- src/dialogs/more-info/ha-more-info-logbook.ts | 2 +- src/panels/logbook/ha-panel-logbook.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dialogs/more-info/ha-more-info-logbook.ts b/src/dialogs/more-info/ha-more-info-logbook.ts index 4f3e89b3a9..08ddc48734 100644 --- a/src/dialogs/more-info/ha-more-info-logbook.ts +++ b/src/dialogs/more-info/ha-more-info-logbook.ts @@ -127,7 +127,7 @@ export class MoreInfoLogbook extends LitElement { this.entityId, true ), - loadTraceContexts(this.hass), + this.hass.user?.is_admin ? loadTraceContexts(this.hass) : {}, this._fetchUserPromise, ]); this._logbookEntries = this._logbookEntries diff --git a/src/panels/logbook/ha-panel-logbook.ts b/src/panels/logbook/ha-panel-logbook.ts index aa5aab7245..aa465e51c5 100644 --- a/src/panels/logbook/ha-panel-logbook.ts +++ b/src/panels/logbook/ha-panel-logbook.ts @@ -257,7 +257,9 @@ export class HaPanelLogbook extends LitElement { this._endDate.toISOString(), this._entityId ), - isComponentLoaded(this.hass, "trace") ? loadTraceContexts(this.hass) : {}, + isComponentLoaded(this.hass, "trace") && this.hass.user?.is_admin + ? loadTraceContexts(this.hass) + : {}, this._fetchUserPromise, ]);