From 698d71fb3a6e75a9b223d2e018d1f7d15227765a Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 17 May 2025 19:39:48 +0200 Subject: [PATCH] Feature/restrict permissions of demo user (#4697) * Restrict permissions of demo user * Update changelog --- CHANGELOG.md | 1 + apps/api/src/app/user/user.service.ts | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9b2ba32..f509061e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Harmonized the data providers management style of the admin control panel +- Restricted the permissions of the demo user - Renamed `Order` to `activities` in the `User` database schema - Improved the language localization for Catalan (`ca`) - Improved the language localization for Chinese (`zh`) diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.ts index cf55b886..87c82fa0 100644 --- a/apps/api/src/app/user/user.service.ts +++ b/apps/api/src/app/user/user.service.ts @@ -394,9 +394,11 @@ export class UserService { // Reset holdings view mode user.Settings.settings.holdingsViewMode = undefined; } else if (user.subscription?.type === 'Premium') { - currentPermissions.push(permissions.createApiKey); - currentPermissions.push(permissions.enableDataProviderGhostfolio); - currentPermissions.push(permissions.reportDataGlitch); + if (!hasRole(user, Role.DEMO)) { + currentPermissions.push(permissions.createApiKey); + currentPermissions.push(permissions.enableDataProviderGhostfolio); + currentPermissions.push(permissions.reportDataGlitch); + } currentPermissions = without( currentPermissions,