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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
disable direct uploads when use_iam_profile is true (#9049)
Markus Kahleebf873eb193
diff --git a/docs/installation-and-operations/configuration/README.md b/docs/installation-and-operations/configuration/README.mdindex d47c8e23d15..5a9551d760f 100644--- a/docs/installation-and-operations/configuration/README.md+++ b/docs/installation-and-operations/configuration/README.md@@ -187,7 +187,7 @@ If, for what ever reason, this is undesirable, you can disable this option.In that case attachments will be posted as usual to the OpenProject server which then uploads the fileto the remote storage in an extra step.-**Note**: This only works for S3 right now. When using fog with another provider this configuration will be `false`. The same goes for when no fog storage is configured.+**Note**: This only works for S3 right now. When using fog with another provider this configuration will be `false`. The same goes for when no fog storage is configured, or when the `use_iam_profile` option is used in the fog credentials when using S3.### fog download url expires indiff --git a/lib/open_project/configuration/helpers.rb b/lib/open_project/configuration/helpers.rbindex cff03a10d86..dbb93daeec4 100644--- a/lib/open_project/configuration/helpers.rb+++ b/lib/open_project/configuration/helpers.rb@@ -44,9 +44,12 @@ module OpenProject### We only allow direct uploads to S3 as we are using the carrierwave_direct# gem which only supports S3 for the time being.+ #+ # Do not allow direct uploads when using IAM-profile-based authorization rather+ # than access-key-based ones since carrierwave_direct does not support that.def direct_uploads- return false unless remote_storage?- return false unless remote_storage_aws?+ return false unless remote_storage? && remote_storage_aws?+ return false if use_iam_profile?self['direct_uploads']end@@ -96,6 +99,10 @@ module OpenProjectRails.root.join(self['attachments_storage_path'] || 'files')end+ def use_iam_profile?+ fog_credentials[:use_iam_profile]+ end+def fog_credentialsHash[(Hash(self['fog'])['credentials'] || {}).map { |key, value| [key.to_sym, value] }]end