Rename Snitch

This commit is contained in:
Marcello Rocha
2024-07-24 10:52:14 +02:00
parent 232323be52
commit bdbd24f5dd
15 changed files with 160 additions and 27 deletions
@@ -1,5 +1,33 @@
# frozen_string_literal: true
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2024 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
require "dry/auto_inject"
module Storages
@@ -1,6 +1,31 @@
# frozen_string_literal: true
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2024 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
module Storages
@@ -1,6 +1,31 @@
# frozen_string_literal: true
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2024 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
module Storages
@@ -36,7 +36,7 @@ module Storages
extend Dry::Container::Mixin
class Resolver < Dry::Container::Resolver
include Snitch
include TaggedLogging
def call(container, key)
with_tagged_logger("Registry") do
info "Resolving #{key}"
@@ -33,7 +33,7 @@ module Storages
module StorageInteraction
module Nextcloud
class AddUserToGroupCommand
include Snitch
include TaggedLogging
def initialize(storage)
@storage = storage
@@ -33,7 +33,7 @@ module Storages
module StorageInteraction
module Nextcloud
class FileIdsQuery
include Snitch
include TaggedLogging
def self.call(storage:, path:)
new(storage).call(path:)
end
@@ -33,7 +33,7 @@ module Storages
module StorageInteraction
module Nextcloud
class GroupUsersQuery
include Snitch
include TaggedLogging
using ServiceResultRefinements
def self.call(storage:, group: storage.group)
@@ -34,7 +34,7 @@ module Storages
module Nextcloud
module Internal
class PropfindQueryLegacy
include Snitch
include TaggedLogging
def self.call(storage:, depth:, path:, props:)
new(storage).call(depth:, path:, props:)
end
@@ -33,7 +33,7 @@ module Storages
module StorageInteraction
module Nextcloud
class RemoveUserFromGroupCommand
include Snitch
include TaggedLogging
def self.call(storage:, user:, group: storage.group)
new(storage).call(user:, group:)
end
@@ -33,7 +33,7 @@ module Storages
module StorageInteraction
module Nextcloud
class RenameFileCommand
include Snitch
include TaggedLogging
def self.call(storage:, auth_strategy:, file_id:, name:)
new(storage).call(auth_strategy:, file_id:, name:)
@@ -33,7 +33,7 @@ module Storages
module StorageInteraction
module Nextcloud
class SetPermissionsCommand
include Snitch
include TaggedLogging
using ServiceResultRefinements
SUCCESS_XPATH = "/d:multistatus/d:response/d:propstat[d:status[text() = 'HTTP/1.1 200 OK']]/d:prop/nc:acl-list"
@@ -1,3 +1,33 @@
# frozen_string_literal: true
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2024 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
module Storages
module Peripherals
module StorageInteraction
@@ -1,18 +0,0 @@
# frozen_string_literal: true
#-- copyright
#++
module Storages
module Snitch
delegate :info, :error, to: :logger
def with_tagged_logger(tag = self.class, &)
logger.tagged(*tag, &)
end
def logger
Rails.logger
end
end
end
@@ -0,0 +1,43 @@
# frozen_string_literal: true
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2024 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
module Storages
module TaggedLogging
delegate :info, :error, to: :logger
def with_tagged_logger(tag = self.class, &)
logger.tagged(*tag, &)
end
def logger
Rails.logger
end
end
end
@@ -32,7 +32,7 @@ module Storages
class NextcloudGroupFolderPropertiesSyncService
extend ActiveModel::Naming
extend ActiveModel::Translation
include Snitch
include TaggedLogging
using Peripherals::ServiceResultRefinements