Skip to content

Commit

Permalink
check for whether the provider allows add/update (#2431)
Browse files Browse the repository at this point in the history
  • Loading branch information
adlius authored Dec 15, 2024
1 parent dafe64c commit 842d63d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/packages/files/service-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default class ServiceFile {
@tracked waterButlerRevisions?: WaterButlerRevision[];
@tracked userCanDownloadAsZip: boolean;
@tracked canMoveToThisProvider: boolean;
@tracked canAddOrUpdate: boolean;
shouldShowTags = false;
shouldShowRevisions: boolean;
providerHandlesVersioning: boolean;
Expand All @@ -75,6 +76,7 @@ export default class ServiceFile {
this.configuredStorageAddon = configuredStorageAddon;
this.userCanDownloadAsZip = false;
this.canMoveToThisProvider = false;
this.canAddOrUpdate = false;
this.getSupportedFeatures();
this.providerHandlesVersioning = configuredStorageAddon.connectedOperationNames
.includes(ConnectedStorageOperationNames.HasRevisions);
Expand All @@ -89,6 +91,8 @@ export default class ServiceFile {
.includes(ExternalServiceCapabilities.DOWNLOAD_AS_ZIP);
this.canMoveToThisProvider = externalStorageService.get('supportedFeatures')
.includes(ExternalServiceCapabilities.COPY_INTO);
this.canAddOrUpdate = externalStorageService.get('supportedFeatures')
.includes(ExternalServiceCapabilities.ADD_UPDATE_FILES);
}

get isFile() {
Expand All @@ -110,7 +114,8 @@ export default class ServiceFile {
get currentUserPermission(): string {
if (
this.fileModel.target.get('currentUserPermissions').includes(Permission.Write) &&
this.configuredStorageAddon.connectedCapabilities.includes(ConnectedCapabilities.Update)
this.configuredStorageAddon.connectedCapabilities.includes(ConnectedCapabilities.Update) &&
this.canAddOrUpdate
) {
return 'write';
}
Expand Down
7 changes: 6 additions & 1 deletion app/packages/files/service-provider-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default class ServiceProviderFile {
@tracked totalFileCount = 0;
@tracked userCanDownloadAsZip: boolean;
@tracked canMoveToThisProvider: boolean;
@tracked canAddOrUpdate: boolean;
providerHandlesVersioning: boolean;
parallelUploadsLimit = 2;

Expand All @@ -41,6 +42,7 @@ export default class ServiceProviderFile {
this.configuredStorageAddon = configuredStorageAddon;
this.userCanDownloadAsZip = false;
this.canMoveToThisProvider = false;
this.canAddOrUpdate = false;
this.getSupportedFeatures();
this.providerHandlesVersioning = configuredStorageAddon.connectedOperationNames
.includes(ConnectedStorageOperationNames.HasRevisions);
Expand All @@ -53,6 +55,8 @@ export default class ServiceProviderFile {
.includes(ExternalServiceCapabilities.DOWNLOAD_AS_ZIP);
this.canMoveToThisProvider = externalStorageService.get('supportedFeatures')
.includes(ExternalServiceCapabilities.COPY_INTO);
this.canAddOrUpdate = externalStorageService.get('supportedFeatures')
.includes(ExternalServiceCapabilities.ADD_UPDATE_FILES);
}

get id() {
Expand All @@ -70,7 +74,8 @@ export default class ServiceProviderFile {
get currentUserPermission(): string {
if (
this.fileModel.target.get('currentUserPermissions').includes(Permission.Write) &&
this.configuredStorageAddon.connectedCapabilities.includes(ConnectedCapabilities.Update)
this.configuredStorageAddon.connectedCapabilities.includes(ConnectedCapabilities.Update) &&
this.canAddOrUpdate
) {
return 'write';
}
Expand Down

0 comments on commit 842d63d

Please sign in to comment.