feat: reflect django permissions on UI

This commit is contained in:
Kaaybi
2022-11-11 18:33:04 +00:00
parent f7ff604b47
commit 084fe2c050
24 changed files with 301 additions and 113 deletions

View File

@@ -11,7 +11,7 @@ import {
} from '@angular/core'
import { Meta } from '@angular/platform-browser'
import { CookieService } from 'ngx-cookie-service'
import { first, Observable, tap } from 'rxjs'
import { first, Observable, of, tap } from 'rxjs'
import {
BRIGHTNESS,
estimateBrightnessForColor,
@@ -45,6 +45,7 @@ export class SettingsService {
protected baseUrl: string = environment.apiBaseUrl + 'ui_settings/'
private settings: Object = {}
private _permissions: string[]
public displayName: string
@@ -74,6 +75,7 @@ export class SettingsService {
if (this.settings['language']?.length)
this.setLanguage(this.settings['language'])
this.displayName = uisettings.display_name.trim()
this._permissions = uisettings.permissions
})
)
}
@@ -455,4 +457,8 @@ export class SettingsService {
this.savedViewService.dashboardViews.length == 0
)
}
public permissions(): Observable<string[]> {
return of(this._permissions)
}
}