Browse Source

Restrict update of activity tags in impersonation mode

pull/7206/head
Thomas Kaul 2 weeks ago
parent
commit
9c2aec5838
  1. 3
      apps/api/src/app/portfolio/portfolio.controller.ts
  2. 6
      apps/api/src/app/portfolio/portfolio.service.ts

3
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

6
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,

Loading…
Cancel
Save