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

Do not use runtime constant look up.

Pavel Balashovf6de0f78951f
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/storage_commands.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/storage_commands.rb
index 2f8b3e879e0..761ffb92cbc 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/storage_commands.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/storage_commands.rb
@@ -35,8 +35,14 @@ module Storages::Peripherals::StorageInteraction
end
def set_permissions_command
- command_class = "::Storages::Peripherals::StorageInteraction::#{@storage.short_provider_type.capitalize}::SetPermissionsCommand".constantize
- ServiceResult.success(result: command_class.new(@storage))
+ case @storage.provider_type
+ when ::Storages::Storage::PROVIDER_TYPE_NEXTCLOUD
+ ServiceResult.success(
+ result: ::Storages::Peripherals::StorageInteraction::Nextcloud::SetPermissionsCommand.new(@storage)
+ )
+ else
+ raise ArgumentError
+ end
end
end
end