From 2a2a5f4da52d8d4c955b6774c981473465df9f1a Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 20 Feb 2022 14:16:46 +0100 Subject: [PATCH] Feature/display features based on permissions (#714) * Display features based on permissions * Update changelog --- CHANGELOG.md | 6 ++++++ .../pages/features/features-page.component.ts | 16 ++++++++++++++-- .../src/app/pages/features/features-page.html | 8 +++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c56f254d9..f99a25f35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Displayed features in features overview page based on permissions + ## 1.117.0 - 19.02.2022 ### Changed diff --git a/apps/client/src/app/pages/features/features-page.component.ts b/apps/client/src/app/pages/features/features-page.component.ts index 3137443cc..ff71a5259 100644 --- a/apps/client/src/app/pages/features/features-page.component.ts +++ b/apps/client/src/app/pages/features/features-page.component.ts @@ -1,6 +1,8 @@ import { ChangeDetectorRef, Component, OnDestroy } from '@angular/core'; +import { DataService } from '@ghostfolio/client/services/data.service'; import { UserService } from '@ghostfolio/client/services/user/user.service'; -import { User } from '@ghostfolio/common/interfaces'; +import { InfoItem, User } from '@ghostfolio/common/interfaces'; +import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { Subject, takeUntil } from 'rxjs'; @Component({ @@ -10,6 +12,8 @@ import { Subject, takeUntil } from 'rxjs'; templateUrl: './features-page.html' }) export class FeaturesPageComponent implements OnDestroy { + public hasPermissionForSubscription: boolean; + public info: InfoItem; public user: User; private unsubscribeSubject = new Subject(); @@ -19,8 +23,11 @@ export class FeaturesPageComponent implements OnDestroy { */ public constructor( private changeDetectorRef: ChangeDetectorRef, + private dataService: DataService, private userService: UserService - ) {} + ) { + this.info = this.dataService.fetchInfo(); + } /** * Initializes the controller @@ -35,6 +42,11 @@ export class FeaturesPageComponent implements OnDestroy { this.changeDetectorRef.markForCheck(); } }); + + this.hasPermissionForSubscription = hasPermission( + this.info?.globalPermissions, + permissions.enableSubscription + ); } public ngOnDestroy() { diff --git a/apps/client/src/app/pages/features/features-page.html b/apps/client/src/app/pages/features/features-page.html index baa2aa844..42c460542 100644 --- a/apps/client/src/app/pages/features/features-page.html +++ b/apps/client/src/app/pages/features/features-page.html @@ -89,6 +89,7 @@

Portfolio Calculations @@ -107,6 +108,7 @@

Portfolio Allocations @@ -139,7 +141,10 @@ -
+

@@ -163,6 +168,7 @@

Static Analysis