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

[#44767] Anonymouse User has Nextcloud access token

Andreas Pfohl82b72d7ac02b
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 775e1e6ffa2..6900966d9cf 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
@@ -33,6 +33,7 @@ import {
} from '@angular/core';
import {
combineLatest,
+ merge,
Observable,
} from 'rxjs';
import {
@@ -88,9 +89,12 @@ export class WorkPackageFilesTabComponent implements OnInit {
return;
}
- const canViewFileLinks = this
- .currentUserService
- .hasCapabilities$('file_links/view', project.id);
+ // ToDo: Needs to be fixed after capabilities are available for anonymous user.
+ // https://community.openproject.org/projects/openproject/work_packages/44850/activity
+ const canViewFileLinks = merge(
+ this.currentUserService.isLoggedIn$.pipe(map((isLoggedIn) => !isLoggedIn)),
+ this.currentUserService.hasCapabilities$('file_links/view', project.id),
+ );
this.storages$ = this
.storagesResourceService
diff --git a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.component.ts b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.component.ts
index 611c03e2ed7..503dacb221e 100644
--- a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.component.ts
+++ b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.component.ts
@@ -87,6 +87,8 @@ export class FileLinkListComponent extends UntilDestroyedMixin implements OnInit
showLinkFilesAction = new BehaviorSubject<boolean>(false);
+ private isLoggedIn = false;
+
private readonly storageTypeMap:Record<string, string> = {};
text = {
@@ -131,6 +133,10 @@ export class FileLinkListComponent extends UntilDestroyedMixin implements OnInit
this.fileLinks$ = this.fileLinkResourceService.collection(this.collectionKey);
+ this.currentUserService.isLoggedIn$
+ .pipe(this.untilDestroyed())
+ .subscribe((isLoggedIn) => { this.isLoggedIn = isLoggedIn; });
+
this.fileLinks$
.pipe(this.untilDestroyed())
.subscribe((fileLinks) => {
@@ -174,6 +180,12 @@ export class FileLinkListComponent extends UntilDestroyedMixin implements OnInit
}
private instantiateStorageInformation(fileLinks:IFileLink[]):StorageInformationBox[] {
+ // ToDo: Replace with anonymous user capabilities check.
+ // https://community.openproject.org/projects/openproject/work_packages/44850/activity
+ if (!this.isLoggedIn) {
+ return [];
+ }
+
switch (this.storage._links.authorizationState.href) {
case storageFailedAuthorization:
return [this.failedAuthorizationInformation];