Remove not needed admin checks (#23259)

This commit is contained in:
Wendelin 2024-12-11 16:50:35 +01:00 committed by GitHub
parent 0582b8430d
commit e5e168803a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 10 deletions

View File

@ -140,9 +140,7 @@ export class HuiDialogSelectDashboard extends LitElement {
mode: this.hass.panels.lovelace?.config?.mode, mode: this.hass.panels.lovelace?.config?.mode,
}, },
...(this._params!.dashboards || (await fetchDashboards(this.hass))), ...(this._params!.dashboards || (await fetchDashboards(this.hass))),
].filter( ];
(dashboard) => this.hass.user!.is_admin || !dashboard.require_admin
);
const currentPath = this._fromUrlPath || this.hass.defaultPanel; const currentPath = this._fromUrlPath || this.hass.defaultPanel;
for (const dashboard of this._dashboards!) { for (const dashboard of this._dashboards!) {

View File

@ -90,18 +90,15 @@ export class HuiDialogSelectView extends LitElement {
> >
Default Default
</mwc-list-item> </mwc-list-item>
${this._dashboards.map((dashboard) => { ${this._dashboards.map(
if (!this.hass.user!.is_admin && dashboard.require_admin) { (dashboard) => html`
return "";
}
return html`
<mwc-list-item <mwc-list-item
.disabled=${dashboard.mode !== "storage"} .disabled=${dashboard.mode !== "storage"}
.value=${dashboard.url_path} .value=${dashboard.url_path}
>${dashboard.title}</mwc-list-item >${dashboard.title}</mwc-list-item
> >
`; `
})} )}
</ha-select>` </ha-select>`
: ""} : ""}
${!this._config || (this._config.views || []).length < 1 ${!this._config || (this._config.views || []).length < 1