Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Hide storages in files tab based on permission

Andreas Pfohl33ea0c7c7bb3
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.ts
index c54b7ca6edc..8a0a3502cf9 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.component.ts
@@ -30,6 +30,8 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { HookService } from 'core-app/features/plugins/hook-service';
+import { Observable } from 'rxjs';
+import { CurrentUserService } from 'core-app/core/current-user/current-user.service';
@Component({
selector: 'op-files-tab',
@@ -48,8 +50,13 @@ export class WorkPackageFilesTabComponent {
},
};
+ $can_view_file_links:Observable<boolean> = this
+ .currentUserService
+ .hasCapabilities$('file_links/view');
+
constructor(
readonly I18n:I18nService,
protected hook:HookService,
+ private currentUserService:CurrentUserService,
) { }
}
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
index 4526559df16..f70a9a48b9e 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
@@ -1,7 +1,6 @@
<div class="op-tab-content--container">
<section data-qa-selector="op-tab-content--tab-section">
- <!-- The condition below will get replaced when implementing #41905. -->
- <div *ngIf="true" class="op-tab-content--header">
+ <div *ngIf="($can_view_file_links | async) === false" class="op-tab-content--header">
<h3 class="op-tab-content--header-text" [textContent]="text.attachments.label"></h3>
</div>
@@ -10,7 +9,7 @@
<op-attachments-upload [resource]="workPackage"></op-attachments-upload>
</section>
- <section *ngIf="true" data-qa-selector="op-tab-content--tab-section">
+ <section *ngIf="$can_view_file_links | async" data-qa-selector="op-tab-content--tab-section">
<div class=op-tab-content--header>
<op-icon icon-classes="icon3 icon-nextcloud-circle op-files-tab--color-blue-deep"></op-icon>
<h3 class="op-tab-content--header-text" [textContent]="text.file_links.label"></h3>