Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/improve read only mode (#2322)
Thomas Kaul1fe1e2fe0c5d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e8b973b065..1e6ad9bba1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Harmonized the logger output: <symbol> (<dataSource>)- Improved the language localization for Italian (`it`)- Improved the language localization for Dutch (`nl`)+- Improved the read-only mode### Fixed@@ -2950,7 +2951,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Supported the management of additional currencies in the admin control panel- Introduced the system message-- Introduced the read only mode+- Introduced the read-only mode### Changeddiff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.tsindex b1b6b94187..a45fbe6344 100644--- a/apps/api/src/app/admin/admin.service.ts+++ b/apps/api/src/app/admin/admin.service.ts@@ -8,7 +8,9 @@ import { PropertyService } from '@ghostfolio/api/services/property/property.servimport { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service';import {DEFAULT_CURRENCY,- PROPERTY_CURRENCIES+ PROPERTY_CURRENCIES,+ PROPERTY_IS_READ_ONLY_MODE,+ PROPERTY_IS_USER_SIGNUP_ENABLED} from '@ghostfolio/common/config';import {AdminData,@@ -305,7 +307,9 @@ export class AdminService {response = await this.propertyService.delete({ key });}- if (key === PROPERTY_CURRENCIES) {+ if (key === PROPERTY_IS_READ_ONLY_MODE && value === 'true') {+ await this.putSetting(PROPERTY_IS_USER_SIGNUP_ENABLED, 'false');+ } else if (key === PROPERTY_CURRENCIES) {await this.exchangeRateDataService.initialize();}diff --git a/apps/client/src/app/pages/pricing/pricing-page.component.ts b/apps/client/src/app/pages/pricing/pricing-page.component.tsindex 6f19a9b46f..f7776f8717 100644--- a/apps/client/src/app/pages/pricing/pricing-page.component.ts+++ b/apps/client/src/app/pages/pricing/pricing-page.component.ts@@ -2,6 +2,7 @@ import { ChangeDetectorRef, Component, OnDestroy, OnInit } 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 { hasPermission, permissions } from '@ghostfolio/common/permissions';import { translate } from '@ghostfolio/ui/i18n';import { StripeService } from 'ngx-stripe';import { Subject } from 'rxjs';@@ -17,6 +18,7 @@ export class PricingPageComponent implements OnDestroy, OnInit {public baseCurrency: string;public coupon: number;public couponId: string;+ public hasPermissionToUpdateUserSettings: boolean;public importAndExportTooltipBasic = translate('DATA_IMPORT_AND_EXPORT_TOOLTIP_BASIC');@@ -55,6 +57,11 @@ export class PricingPageComponent implements OnDestroy, OnInit {if (state?.user) {this.user = state.user;+ this.hasPermissionToUpdateUserSettings = hasPermission(+ this.user.permissions,+ permissions.updateUserSettings+ );+this.coupon = subscriptions?.[this.user?.subscription?.offer]?.coupon;this.couponId =subscriptions?.[this.user.subscription.offer]?.couponId;diff --git a/apps/client/src/app/pages/pricing/pricing-page.html b/apps/client/src/app/pages/pricing/pricing-page.htmlindex abd169a5ef..1c1bb6c413 100644--- a/apps/client/src/app/pages/pricing/pricing-page.html+++ b/apps/client/src/app/pages/pricing/pricing-page.html@@ -333,7 +333,7 @@></p><div- *ngIf="user?.subscription?.type === 'Basic'"+ *ngIf="hasPermissionToUpdateUserSettings && user?.subscription?.type === 'Basic'"class="mt-3 text-center"><button color="primary" mat-flat-button (click)="onCheckout()">diff --git a/apps/client/src/app/pages/user-account/user-account-page.html b/apps/client/src/app/pages/user-account/user-account-page.htmlindex 33c4e497ed..606aa9223a 100644--- a/apps/client/src/app/pages/user-account/user-account-page.html+++ b/apps/client/src/app/pages/user-account/user-account-page.html@@ -8,10 +8,7 @@<div class="col"><mat-card appearance="outlined" class="mb-3"><mat-card-content>- <div- *ngIf="hasPermissionToUpdateUserSettings && user?.subscription"- class="d-flex py-1"- >+ <div *ngIf="user?.subscription" class="d-flex py-1"><div class="pr-1 w-50" i18n>Membership</div><div class="pl-1 w-50"><div class="align-items-center d-flex mb-1">@@ -28,7 +25,9 @@user?.subscription?.expiresAt | date: defaultDateFormat }}</div><div *ngIf="user?.subscription?.type === 'Basic'">- <ng-container *ngIf="hasPermissionForSubscription">+ <ng-container+ *ngIf="hasPermissionForSubscription && hasPermissionToUpdateUserSettings"+ ><buttoncolor="primary"mat-flat-button@@ -69,6 +68,7 @@></gf-premium-indicator></a><a+ *ngIf="hasPermissionToUpdateUserSettings"class="mr-2 my-2"i18nmat-stroked-button