Feature/disable base currency selector for demo user (#104)

* Disable base currency selector based on permission

* Update changelog
This commit is contained in:
Thomas 2021-05-18 19:36:24 +02:00 committed by GitHub
parent 277133fa1a
commit 77255df4be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Renamed _Ghostfolio Account_ to _My Ghostfolio_ - Renamed _Ghostfolio Account_ to _My Ghostfolio_
- Hid unknown exchange in the position overview - Hid unknown exchange in the position overview
- Disable the base currency selector for the demo user
- Refactored the portfolio unit tests to work without database - Refactored the portfolio unit tests to work without database
- Renamed shared helper to `@ghostfolio/common/helper` - Renamed shared helper to `@ghostfolio/common/helper`
- Moved shared interfaces to `@ghostfolio/common/interfaces` - Moved shared interfaces to `@ghostfolio/common/interfaces`

View File

@ -19,6 +19,7 @@ export class AccountPageComponent implements OnDestroy, OnInit {
public currencies: Currency[] = []; public currencies: Currency[] = [];
public defaultDateFormat = DEFAULT_DATE_FORMAT; public defaultDateFormat = DEFAULT_DATE_FORMAT;
public hasPermissionForSubscription: boolean; public hasPermissionForSubscription: boolean;
public hasPermissionToUpdateUserSettings: boolean;
public user: User; public user: User;
private unsubscribeSubject = new Subject<void>(); private unsubscribeSubject = new Subject<void>();
@ -50,6 +51,11 @@ export class AccountPageComponent implements OnDestroy, OnInit {
this.dataService.fetchUser().subscribe((user) => { this.dataService.fetchUser().subscribe((user) => {
this.user = user; this.user = user;
this.hasPermissionToUpdateUserSettings = hasPermission(
this.user.permissions,
permissions.updateUserSettings
);
this.cd.markForCheck(); this.cd.markForCheck();
}); });
}); });

View File

@ -35,6 +35,7 @@
<mat-label i18n>Base Currency</mat-label> <mat-label i18n>Base Currency</mat-label>
<mat-select <mat-select
name="baseCurrency" name="baseCurrency"
[disabled]="!hasPermissionToUpdateUserSettings"
[value]="user.settings.baseCurrency" [value]="user.settings.baseCurrency"
(selectionChange)="onChangeBaseCurrency($event)" (selectionChange)="onChangeBaseCurrency($event)"
> >