Portal search results remove link if user has not permission to visit a specific dashboard
This commit is contained in:
parent
1c3a3d6007
commit
0b3e699796
|
@ -18,52 +18,19 @@
|
|||
<span class="space uk-text-small uk-text-capitalize">{{result.visibility.toLowerCase()}}</span>
|
||||
</div>-->
|
||||
<div class="uk-grid uk-flex uk-flex-middle" uk-grid>
|
||||
<a *ngIf="directLink" [href]="(type === 'community')?getCommunityPageUrl(result):getStakeholderPageUrl(result)"
|
||||
<a *ngIf="directLink && hasPermission(result)" [href]="(type === 'community')?getCommunityPageUrl(result):getStakeholderPageUrl(result)"
|
||||
target="_blank"
|
||||
class="uk-width-1-5@s">
|
||||
<div class="uk-flex uk-flex-center">
|
||||
<img *ngIf="result.logoUrl && result.logoUrl != '' && result.isUpload "
|
||||
[src]="properties.utilsService + '/download/' + result.logoUrl"
|
||||
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
|
||||
<img *ngIf="result.logoUrl && result.logoUrl != '' && !result.isUpload " [src]="result.logoUrl | urlPrefix"
|
||||
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
|
||||
<span *ngIf="result.logoUrl == null || result.logoUrl == ''" class="uk-icon">
|
||||
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none"
|
||||
stroke="#000"
|
||||
stroke-width="1.1"
|
||||
cx="7.7" cy="8.6"
|
||||
r="3.5"></circle> <path
|
||||
fill="none" stroke="#000" stroke-width="1.1"
|
||||
d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path> <path fill="none"
|
||||
stroke="#000"
|
||||
stroke-width="1.1"
|
||||
d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg>
|
||||
</span>
|
||||
</div>
|
||||
<ng-container *ngTemplateOutlet="resultPreview; context: {result: result}"></ng-container>
|
||||
</a>
|
||||
<a *ngIf="!directLink"
|
||||
<a *ngIf="!directLink && hasPermission(result)"
|
||||
class="uk-width-1-5@s"
|
||||
(click)="confirmModalOpen(result)">
|
||||
<div class="uk-flex uk-flex-center">
|
||||
<img *ngIf="result.logoUrl && result.logoUrl != '' && result.isUpload "
|
||||
[src]="properties.utilsService + '/download/' + result.logoUrl"
|
||||
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
|
||||
<img *ngIf="result.logoUrl && result.logoUrl != '' && !result.isUpload " [src]="result.logoUrl | urlPrefix"
|
||||
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
|
||||
<span *ngIf="(result.logoUrl == null || result.logoUrl == '' )" class="uk-icon">
|
||||
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none"
|
||||
stroke="#000"
|
||||
stroke-width="1.1"
|
||||
cx="7.7" cy="8.6"
|
||||
r="3.5"></circle> <path
|
||||
fill="none" stroke="#000" stroke-width="1.1"
|
||||
d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path> <path fill="none"
|
||||
stroke="#000"
|
||||
stroke-width="1.1"
|
||||
d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg>
|
||||
</span>
|
||||
</div>
|
||||
<ng-container *ngTemplateOutlet="resultPreview; context: {result: result}"></ng-container>
|
||||
</a>
|
||||
<div *ngIf="!hasPermission(result)" class="uk-width-1-5@s">
|
||||
<ng-container *ngTemplateOutlet="resultPreview; context: {result: result}"></ng-container>
|
||||
</div>
|
||||
<div class="uk-width-expand">
|
||||
<div *ngIf="type === 'community'" [title]="result.shortTitle" class="uk-text-large uk-grid" uk-grid>
|
||||
<a *ngIf="directLink" [href]="getCommunityPageUrl(result)" target="_blank"
|
||||
|
@ -78,14 +45,17 @@
|
|||
class="uk-width-expand uk-margin-auto-right"></manage>
|
||||
</div>
|
||||
<div *ngIf="type === 'stakeholder'" [title]="result.index_shortName" class="uk-text-large uk-grid">
|
||||
<a *ngIf="directLink" [href]="getStakeholderPageUrl(result)" target="_blank"
|
||||
[class]="(result.isManager)?'uk-width-3-4@s portal-link':'portal-link'">
|
||||
<a *ngIf="directLink && hasPermission(result)" [href]="getStakeholderPageUrl(result)" target="_blank"
|
||||
[class.uk-width-3-4@s]="result.isManager" class="portal-link">
|
||||
{{(result.name) ? result.name : result.index_shortName}}
|
||||
</a>
|
||||
<a *ngIf="!directLink" (click)="confirmModalOpen(result)" [class]="(result.isManager)?'uk-width-3-4@s':''"
|
||||
<a *ngIf="!directLink && hasPermission(result)" (click)="confirmModalOpen(result)" [class.uk-width-3-4@s]="result.isManager"
|
||||
class="portal-link">
|
||||
{{(result.name) ? result.name : result.index_shortName}}
|
||||
</a>
|
||||
<div *ngIf="!hasPermission(result)" [class.uk-width-3-4@s]="result.isManager">
|
||||
{{(result.name) ? result.name : result.index_shortName}}
|
||||
</div>
|
||||
<manage *ngIf="result.isManager" [alias]="result.alias"
|
||||
class="uk-width-expand uk-margin-auto-right"></manage>
|
||||
</div>
|
||||
|
@ -120,4 +90,24 @@
|
|||
You will be navigated to a new tab. Are you sure that you want to proceed?
|
||||
</div>
|
||||
</modal-alert>
|
||||
|
||||
<ng-template #resultPreview let-result="result">
|
||||
<div class="uk-flex uk-flex-center">
|
||||
<img *ngIf="result.logoUrl && result.logoUrl != '' && result.isUpload "
|
||||
[src]="properties.utilsService + '/download/' + result.logoUrl"
|
||||
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
|
||||
<img *ngIf="result.logoUrl && result.logoUrl != '' && !result.isUpload " [src]="result.logoUrl | urlPrefix"
|
||||
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
|
||||
<span *ngIf="result.logoUrl == null || result.logoUrl == ''" class="uk-icon">
|
||||
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none"
|
||||
stroke="#000"
|
||||
stroke-width="1.1"
|
||||
cx="7.7" cy="8.6"
|
||||
r="3.5"></circle> <path
|
||||
fill="none" stroke="#000" stroke-width="1.1"
|
||||
d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path> <path fill="none"
|
||||
stroke="#000"
|
||||
stroke-width="1.1"
|
||||
d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg>
|
||||
</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
|
|
@ -51,6 +51,9 @@ export class PortalSearchResultComponent implements OnInit{
|
|||
});
|
||||
}
|
||||
|
||||
hasPermission(result: CommunityInfo & StakeholderInfo) {
|
||||
return this.type === "community" || result.visibility === "PUBLIC" || result.isManager || result.isMember;
|
||||
}
|
||||
|
||||
getProductionPrefix(id:string): string {
|
||||
return (this.properties.environment == "production") ? "" : "beta.";
|
||||
|
|
Loading…
Reference in New Issue