@ -74,6 +74,11 @@ export class PortfolioController {
) : Promise < PortfolioDetails & { hasError : boolean } > {
) : Promise < PortfolioDetails & { hasError : boolean } > {
let hasDetails = true ;
let hasDetails = true ;
let hasError = false ;
let hasError = false ;
const hasReadRestrictedAccessPermission =
this . userService . hasReadRestrictedAccessPermission ( {
impersonationId ,
user : this.request.user
} ) ;
if ( this . configurationService . get ( 'ENABLE_FEATURE_SUBSCRIPTION' ) ) {
if ( this . configurationService . get ( 'ENABLE_FEATURE_SUBSCRIPTION' ) ) {
hasDetails = this . request . user . subscription . type === 'Premium' ;
hasDetails = this . request . user . subscription . type === 'Premium' ;
@ -108,7 +113,7 @@ export class PortfolioController {
let portfolioSummary = summary ;
let portfolioSummary = summary ;
if (
if (
impersonationId ||
hasReadRestrictedAccessPermission ||
this . userService . isRestrictedView ( this . request . user )
this . userService . isRestrictedView ( this . request . user )
) {
) {
const totalInvestment = Object . values ( holdings )
const totalInvestment = Object . values ( holdings )
@ -148,7 +153,7 @@ export class PortfolioController {
if (
if (
hasDetails === false ||
hasDetails === false ||
impersonationId ||
hasReadRestrictedAccessPermission ||
this . userService . isRestrictedView ( this . request . user )
this . userService . isRestrictedView ( this . request . user )
) {
) {
portfolioSummary = nullifyValuesInObject ( summary , [
portfolioSummary = nullifyValuesInObject ( summary , [
@ -164,6 +169,7 @@ export class PortfolioController {
'excludedAccountsAndActivities' ,
'excludedAccountsAndActivities' ,
'fees' ,
'fees' ,
'fireWealth' ,
'fireWealth' ,
'interest' ,
'items' ,
'items' ,
'liabilities' ,
'liabilities' ,
'netWorth' ,
'netWorth' ,
@ -216,6 +222,12 @@ export class PortfolioController {
@Query ( 'range' ) dateRange : DateRange = 'max' ,
@Query ( 'range' ) dateRange : DateRange = 'max' ,
@Query ( 'tags' ) filterByTags? : string
@Query ( 'tags' ) filterByTags? : string
) : Promise < PortfolioDividends > {
) : Promise < PortfolioDividends > {
const hasReadRestrictedAccessPermission =
this . userService . hasReadRestrictedAccessPermission ( {
impersonationId ,
user : this.request.user
} ) ;
const filters = this . apiService . buildFiltersFromQueryParams ( {
const filters = this . apiService . buildFiltersFromQueryParams ( {
filterByAccounts ,
filterByAccounts ,
filterByAssetClasses ,
filterByAssetClasses ,
@ -230,7 +242,7 @@ export class PortfolioController {
} ) ;
} ) ;
if (
if (
impersonationId ||
hasReadRestrictedAccessPermission ||
this . userService . isRestrictedView ( this . request . user )
this . userService . isRestrictedView ( this . request . user )
) {
) {
const maxDividend = dividends . reduce (
const maxDividend = dividends . reduce (
@ -266,6 +278,12 @@ export class PortfolioController {
@Query ( 'range' ) dateRange : DateRange = 'max' ,
@Query ( 'range' ) dateRange : DateRange = 'max' ,
@Query ( 'tags' ) filterByTags? : string
@Query ( 'tags' ) filterByTags? : string
) : Promise < PortfolioInvestments > {
) : Promise < PortfolioInvestments > {
const hasReadRestrictedAccessPermission =
this . userService . hasReadRestrictedAccessPermission ( {
impersonationId ,
user : this.request.user
} ) ;
const filters = this . apiService . buildFiltersFromQueryParams ( {
const filters = this . apiService . buildFiltersFromQueryParams ( {
filterByAccounts ,
filterByAccounts ,
filterByAssetClasses ,
filterByAssetClasses ,
@ -281,7 +299,7 @@ export class PortfolioController {
} ) ;
} ) ;
if (
if (
impersonationId ||
hasReadRestrictedAccessPermission ||
this . userService . isRestrictedView ( this . request . user )
this . userService . isRestrictedView ( this . request . user )
) {
) {
const maxInvestment = investments . reduce (
const maxInvestment = investments . reduce (
@ -329,6 +347,12 @@ export class PortfolioController {
@Query ( 'tags' ) filterByTags? : string ,
@Query ( 'tags' ) filterByTags? : string ,
@Query ( 'withExcludedAccounts' ) withExcludedAccounts = false
@Query ( 'withExcludedAccounts' ) withExcludedAccounts = false
) : Promise < PortfolioPerformanceResponse > {
) : Promise < PortfolioPerformanceResponse > {
const hasReadRestrictedAccessPermission =
this . userService . hasReadRestrictedAccessPermission ( {
impersonationId ,
user : this.request.user
} ) ;
const filters = this . apiService . buildFiltersFromQueryParams ( {
const filters = this . apiService . buildFiltersFromQueryParams ( {
filterByAccounts ,
filterByAccounts ,
filterByAssetClasses ,
filterByAssetClasses ,
@ -344,7 +368,7 @@ export class PortfolioController {
} ) ;
} ) ;
if (
if (
impersonationId ||
hasReadRestrictedAccessPermission ||
this . request . user . Settings . settings . viewMode === 'ZEN' ||
this . request . user . Settings . settings . viewMode === 'ZEN' ||
this . userService . isRestrictedView ( this . request . user )
this . userService . isRestrictedView ( this . request . user )
) {
) {