Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Task/restrict update of activity tags in impersonation mode (#7206)

Thomas Kaul6d4845fa8dfb
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c9d1783da..5ec0188553 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Restricted the modification of activity tags in the impersonation mode
- Hardened the endpoint of the public access for portfolio sharing by restricting it to public accesses
- Improved the language localization by translating various tooltips across the application
- Improved the language localization for Ukrainian (`uk`)
diff --git a/apps/api/src/app/portfolio/portfolio.controller.ts b/apps/api/src/app/portfolio/portfolio.controller.ts
index ca94605f90..13cc0eae7c 100644
--- a/apps/api/src/app/portfolio/portfolio.controller.ts
+++ b/apps/api/src/app/portfolio/portfolio.controller.ts
@@ -672,13 +672,11 @@ export class PortfolioController {
@UseGuards(AuthGuard('jwt'), HasPermissionGuard)
public async updateHoldingTags(
@Body() data: UpdateHoldingTagsDto,
- @Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string,
@Param('dataSource') dataSource: DataSource,
@Param('symbol') symbol: string
): Promise<void> {
const holding = await this.portfolioService.getHolding({
dataSource,
- impersonationId,
symbol,
userId: this.request.user.id
});
@@ -692,7 +690,6 @@ export class PortfolioController {
await this.portfolioService.updateTags({
dataSource,
- impersonationId,
symbol,
tags: data.tags,
userId: this.request.user.id
diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts
index 41697b3465..b440684da1 100644
--- a/apps/api/src/app/portfolio/portfolio.service.ts
+++ b/apps/api/src/app/portfolio/portfolio.service.ts
@@ -777,7 +777,7 @@ export class PortfolioService {
symbol,
userId
}: {
- impersonationId: string;
+ impersonationId?: string;
userId: string;
} & AssetProfileIdentifier): Promise<PortfolioHoldingResponse> {
userId = await this.getUserId(impersonationId, userId);
@@ -1377,17 +1377,13 @@ export class PortfolioService {
public async updateTags({
dataSource,
- impersonationId,
symbol,
tags,
userId
}: {
- impersonationId: string;
tags: Tag[];
userId: string;
} & AssetProfileIdentifier) {
- userId = await this.getUserId(impersonationId, userId);
-
await this.activitiesService.assignTags({
dataSource,
symbol,