diff --git a/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.html b/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.html
index 328cccba1..eceb31df3 100644
--- a/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.html
+++ b/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.html
@@ -18,7 +18,10 @@
Compare with...
diff --git a/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts b/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts
index 0091ae5d7..e21f54aaf 100644
--- a/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts
+++ b/apps/client/src/app/components/benchmark-comparator/benchmark-comparator.component.ts
@@ -69,6 +69,7 @@ export class GfBenchmarkComparatorComponent implements OnChanges, OnDestroy {
public readonly benchmarkDataItems = input([]);
public readonly benchmarks = input[]>();
public readonly colorScheme = input.required();
+ public readonly hasPermissionToUpdateUserSettings = input();
public readonly isLoading = input();
public readonly locale = input(getLocale());
public readonly performanceDataItems = input.required();
diff --git a/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts b/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts
index a4d8a1ba1..83f7ddd9a 100644
--- a/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts
+++ b/apps/client/src/app/components/user-account-settings/user-account-settings.component.ts
@@ -1,3 +1,4 @@
+import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service';
import {
KEY_STAY_SIGNED_IN,
KEY_TOKEN,
@@ -90,6 +91,7 @@ export class GfUserAccountSettingsComponent implements OnInit {
protected readonly deleteOwnUserForm = inject(NonNullableFormBuilder).group({
accessToken: ['', Validators.required]
});
+ protected hasImpersonationId: boolean;
protected hasPermissionToDeleteOwnUser: boolean;
protected hasPermissionToRequestOwnUserDeletion: boolean;
protected hasPermissionToUpdateViewMode: boolean;
@@ -129,6 +131,9 @@ export class GfUserAccountSettingsComponent implements OnInit {
private readonly dataService = inject(DataService);
private readonly deviceDetectorService = inject(DeviceDetectorService);
private readonly destroyRef = inject(DestroyRef);
+ private readonly impersonationStorageService = inject(
+ ImpersonationStorageService
+ );
private readonly notificationService = inject(NotificationService);
private readonly settingsStorageService = inject(SettingsStorageService);
private readonly snackBar = inject(MatSnackBar);
@@ -140,6 +145,17 @@ export class GfUserAccountSettingsComponent implements OnInit {
this.currencies = currencies;
+ this.impersonationStorageService
+ .onChangeHasImpersonation()
+ .pipe(takeUntilDestroyed(this.destroyRef))
+ .subscribe((impersonationId) => {
+ this.hasImpersonationId = !!impersonationId;
+
+ this.updateBaseCurrencyFormState();
+
+ this.changeDetectorRef.markForCheck();
+ });
+
this.userService.stateChanged
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((state) => {
@@ -192,11 +208,7 @@ export class GfUserAccountSettingsComponent implements OnInit {
baseCurrency: this.user.settings.baseCurrency ?? null
});
- if (this.hasPermissionToUpdateUserSettings) {
- this.baseCurrencyForm.enable({ emitEvent: false });
- } else {
- this.baseCurrencyForm.disable({ emitEvent: false });
- }
+ this.updateBaseCurrencyFormState();
if (this.user.settings.locale) {
this.locales.push(this.user.settings.locale);
@@ -431,4 +443,14 @@ export class GfUserAccountSettingsComponent implements OnInit {
this.changeDetectorRef.markForCheck();
}
+
+ private updateBaseCurrencyFormState() {
+ // The base currency belongs to the impersonated user while a change would be
+ // applied to the authenticated user
+ if (!this.hasImpersonationId && this.hasPermissionToUpdateUserSettings) {
+ this.baseCurrencyForm.enable({ emitEvent: false });
+ } else {
+ this.baseCurrencyForm.disable({ emitEvent: false });
+ }
+ }
}
diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts
index 2c34dbcd7..7a5fb8578 100644
--- a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts
+++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts
@@ -88,6 +88,7 @@ export class GfAnalysisPageComponent implements OnInit {
protected dividendsByGroup: InvestmentItem[];
protected readonly dividendTimelineDataLabel = $localize`Dividend`;
protected hasPermissionToReadAiPrompt: boolean;
+ protected hasPermissionToUpdateUserSettings: boolean;
protected impersonationId: string | null;
protected investments: InvestmentItem[];
protected readonly investmentTimelineDataLabel = $localize`Invested Capital`;
@@ -174,6 +175,11 @@ export class GfAnalysisPageComponent implements OnInit {
permissions.readAiPrompt
);
+ this.hasPermissionToUpdateUserSettings = hasPermission(
+ this.user.permissions,
+ permissions.updateUserSettings
+ );
+
this.update();
}
diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.html b/apps/client/src/app/pages/portfolio/analysis/analysis-page.html
index 82751b882..a3e07a4e2 100644
--- a/apps/client/src/app/pages/portfolio/analysis/analysis-page.html
+++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.html
@@ -137,6 +137,9 @@
[benchmarkDataItems]="benchmarkDataItems"
[benchmarks]="benchmarks"
[colorScheme]="user?.settings?.colorScheme"
+ [hasPermissionToUpdateUserSettings]="
+ hasPermissionToUpdateUserSettings && !impersonationId
+ "
[isLoading]="isLoadingBenchmarkComparator || isLoadingInvestmentChart"
[locale]="user?.settings?.locale"
[performanceDataItems]="performanceDataItemsInPercentage"
diff --git a/apps/client/src/app/pages/portfolio/fire/fire-page.html b/apps/client/src/app/pages/portfolio/fire/fire-page.html
index 13693a15a..7315f10cb 100644
--- a/apps/client/src/app/pages/portfolio/fire/fire-page.html
+++ b/apps/client/src/app/pages/portfolio/fire/fire-page.html
@@ -21,7 +21,7 @@
[locale]="user?.settings?.locale"
[projectedTotalAmount]="user?.settings?.projectedTotalAmount"
[retirementDate]="user?.settings?.retirementDate"
- [savingsRate]="hasImpersonationId ? 0 : user?.settings?.savingsRate"
+ [savingsRate]="user?.settings?.savingsRate"
[style.opacity]="
user?.subscription?.type === 'Basic' ? '0.67' : 'initial'
"