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

Use `Util.error` to construct failure result.

Pavel Balashov1491dc771338
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/add_user_to_group_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/add_user_to_group_command.rb
index 3618235a868..c396e4585c9 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/add_user_to_group_command.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/add_user_to_group_command.rb
@@ -54,15 +54,15 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
when "100"
ServiceResult.success(message: "User has been added successfully")
when "101"
- ServiceResult.failure(message: "No group specified")
+ Util.error(:error, "No group specified")
when "102"
- ServiceResult.failure(message: "Group does not exist")
+ Util.error(:error, "Group does not exist")
when "103"
- ServiceResult.failure(message: "User does not exist")
+ Util.error(:error, "User does not exist")
when "104"
- ServiceResult.failure(message: "Insufficient privileges")
+ Util.error(:error, "Insufficient privileges")
when "105"
- ServiceResult.failure(message: "Failed to add user to group")
+ Util.error(:error, "Failed to add user to group")
end
when Net::HTTPMethodNotAllowed
Util.error(:not_allowed)
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/remove_user_from_group_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/remove_user_from_group_command.rb
index 3d62d12c30f..f95b53c6141 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/remove_user_from_group_command.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/remove_user_from_group_command.rb
@@ -54,15 +54,15 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
when "100"
ServiceResult.success(message: "User has been removed from group")
when "101"
- ServiceResult.failure(message: "No group specified")
+ Util.error(:error, "No group specified")
when "102"
- ServiceResult.failure(message: "Group does not exist")
+ Util.error(:error, "Group does not exist")
when "103"
- ServiceResult.failure(message: "User does not exist")
+ Util.error(:error, "User does not exist")
when "104"
- ServiceResult.failure(message: "Insufficient privileges")
+ Util.error(:error, "Insufficient privileges")
when "105"
- ServiceResult.failure(message: "Failed to remove user from group")
+ Util.error(:error, "Failed to remove user from group")
end
when Net::HTTPMethodNotAllowed
Util.error(:not_allowed)
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb
index 6d29fa133ef..add141ff236 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/set_permissions_command.rb
@@ -88,7 +88,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
if doc.xpath("/d:multistatus/d:response/d:propstat[d:status[text() = 'HTTP/1.1 200 OK']]/d:prop/nc:acl-list").present?
ServiceResult.success
else
- ServiceResult.failure
+ Util.error(:error, "nc:acl properly has not been set for #{path}")
end
when Net::HTTPNotFound
Util.error(:not_found)