Skip to content

Commit

Permalink
Merge branch 'dev' into fix/correct-remove-action-logic-for-turbo-str…
Browse files Browse the repository at this point in the history
…eam-response
  • Loading branch information
aaron-contreras authored Oct 2, 2023
2 parents cc44e61 + 5ef93d9 commit c78a7ad
Show file tree
Hide file tree
Showing 16 changed files with 317 additions and 121 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,11 @@ jobs:
with:
node-version: '14'
- run: ./script/api/validate_spec

# github.head_ref is only availabe in PR context and if it is absent then github.run_id
# is used . And github.run_id is unique for each workflow run. So, this option makes
# sure that there is only one build running for a pull request and the build is attached
# to the last commit of the PR.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ gem 'rails-i18n', '~> 7.0.0'
gem 'sprockets', '~> 3.7.2' # lock sprockets below 4.0
gem 'sprockets-rails', '~> 3.4.2'

gem 'puma', '~> 6.3'
gem 'puma', '~> 6.3', '>= 6.3.1'
gem 'puma-plugin-statsd', '~> 2.0'
gem 'rack-timeout', '~> 0.6.3', require: "rack/timeout/base"

Expand Down
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ GEM
tzinfo
eventmachine (1.2.7)
eventmachine_httpserver (0.2.1)
excon (0.103.0)
excon (0.104.0)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
Expand All @@ -478,7 +478,7 @@ GEM
websocket-driver (>= 0.6, < 0.8)
ffi (1.16.2)
flamegraph (0.9.5)
fog-aws (3.20.0)
fog-aws (3.21.0)
fog-core (~> 2.1)
fog-json (~> 1.1)
fog-xml (~> 0.1)
Expand Down Expand Up @@ -520,7 +520,7 @@ GEM
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-gmail_v1 (0.32.0)
google-apis-gmail_v1 (0.33.0)
google-apis-core (>= 0.11.0, < 2.a)
googleauth (1.8.1)
faraday (>= 0.17.3, < 3.a)
Expand Down Expand Up @@ -856,7 +856,7 @@ GEM
rspec-retry (0.6.2)
rspec-core (> 3.3)
rspec-support (3.12.1)
rubocop (1.56.3)
rubocop (1.56.4)
base64 (~> 0.1.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
Expand Down Expand Up @@ -975,7 +975,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (2.4.2)
unicode-display_width (2.5.0)
validate_email (0.1.6)
activemodel (>= 3.0)
mail (>= 2.2.5)
Expand Down Expand Up @@ -1139,7 +1139,7 @@ DEPENDENCIES
pry-rails (~> 0.3.6)
pry-rescue (~> 1.5.2)
puffing-billy (~> 4.0.0)
puma (~> 6.3)
puma (~> 6.3, >= 6.3.1)
puma-plugin-statsd (~> 2.0)
rack-attack (~> 6.7.0)
rack-cors (~> 2.0.0)
Expand Down
8 changes: 4 additions & 4 deletions config/locales/crowdin/lt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ lt:
custom_field: "Kliento laukelis"
'doorkeeper/application': "OAuth aplikacija"
forum: "Forumas"
global_role: "Global role"
global_role: "Visuotinis vaidmuo"
group: "Grupė"
member: "Narys"
news: "Naujienos"
Expand Down Expand Up @@ -1294,8 +1294,8 @@ lt:
other: "%{count} dienos"
x_min_abbreviated:
one: "1 min"
few: "%{count} mins"
many: "%{count} mins"
few: "%{count} min"
many: "%{count} min"
other: "%{count} min"
x_minutes:
one: "1 minutę"
Expand Down Expand Up @@ -1596,7 +1596,7 @@ lt:
label_add_related_work_packages: "Pridėti susijusių darbų paketų"
label_add_subtask: "Pridėti antrinę užduotį"
label_added: "pridėtas"
label_added_by: "Added by %{author}"
label_added_by: "Pridėjo %{author}"
label_added_time_by: "%{author} pridėjo prieš %{age}"
label_additional_workflow_transitions_for_assignee: "Papildomi darbų eigos variantai leistini, kai darbas paskirtas vartotojui"
label_additional_workflow_transitions_for_author: "Papildomi darbų eigos variantai leistini, kai vartotojas yra autorius"
Expand Down
2 changes: 1 addition & 1 deletion config/locales/crowdin/pl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2857,7 +2857,7 @@ pl:
text_work_packages_ref_in_commit_messages: "Odwołania i poprawki do pakietów roboczych w wiadomościach o zmianach"
text_journal_added: "%{label} %{value} added"
text_journal_attachment_added: "%{label} %{value} dodano jako załącznik"
text_journal_attachment_deleted: "%{label} %{old} usunięto jako załącznik"
text_journal_attachment_deleted: "%{label} %{value} usunięto jako załącznik"
text_journal_changed_plain: "%{label} zmieniono z %{old} %{linebreak}na %{new}"
text_journal_changed_no_detail: "%{label} updated"
text_journal_changed_with_diff: "%{label} changed (%{link})"
Expand Down
4 changes: 2 additions & 2 deletions docs/development/concepts/permissions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ However, for most end points, this does not need to be and should not be done on

When a set of records is to be returned, e.g. for an index action, it is best to limit the returned result set to the records the user is allowed to see. To avoid having to apply the permission check after the records have been fetched and instantiated, which is costly, it is best to limit the records in the sql right away. As there are a couple of different scenarios for fetching records, there are a couple of matching scopes defined:

| Schenario | Scope | Example |
|---------- | ------| ------ |
| Scenario | Scope | Example |
|--------- | ------| ------- |
| All projects a user is allowed a permission in | `Authorization.projects(permission, user)` | `Authorization.projects(:view_work_packages, User.current)` |
| All users granted a permission in a project | `Authorization.users(permission, project: project)` | `Authorization.users(:view_work_packages, project: project)` |
| All roles a user has in a project | `Authorization.roles(user, project)` | `Authorization.roles(User.current, project)` |
Expand Down
26 changes: 13 additions & 13 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions modules/meeting/config/locales/crowdin/lt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ lt:
label_meeting_diff: "skirt."
label_upcoming_meetings: "Artėjantys susirinkimai"
label_past_meetings: "Įvykę susirinkimai"
label_upcoming_meetings_short: "Upcoming"
label_past_meetings_short: "Past"
label_upcoming_meetings_short: "Artėjantys"
label_past_meetings_short: "Buvę"
label_involvement: "Įsitraukimas"
label_upcoming_invitations: "Artėjantys pakvietimai"
label_past_invitations: "Ankstesni pakvietimai"
Expand Down Expand Up @@ -149,12 +149,12 @@ lt:
label_meeting_show_hide_participants: "Rodyti/slėpti dar %{count}"
label_meeting_add_participants: "Pridėti dalyvius"
text_meeting_not_editable_anymore: "Šis susitikimas daugiau neberedaguojamas"
text_meeting_not_present_anymore: "This meeting was deleted. Please select another meeting."
text_meeting_not_present_anymore: "Šis susitikimas buvo ištrintas. Prašome parinkti kitą susitikimą."
label_add_work_package_to_meeting_dialog_title: "Pridėti darbo paketą prie susitikimo"
label_add_work_package_to_meeting_dialog_button: "Pridėti į susitikimą"
label_meeting_selection_caption: "It's only possible to add this work package to open, upcoming meetings."
text_add_work_package_to_meeting_description: "A work package can be added to one or multiple meetings for discussion. Any notes concerning it are also visible here."
text_agenda_item_no_notes: "No notes provided"
text_work_package_has_no_upcoming_meeting_agenda_items: "This work package is not scheduled in an upcoming meeting agenda yet."
text_work_package_add_to_meeting_hint: "Use the \"Add to meeting\" button to add this work package to an upcoming meeting."
text_work_package_has_no_past_meeting_agenda_items: "This work package was not mentioned in a past meeting."
label_meeting_selection_caption: "Šį darbo paketą galima pridėti tik į atidarytą, artėjantį susitikimą."
text_add_work_package_to_meeting_description: "Darbo paketą galima pridėti į vieną ar kelis susitikimus diskusijai. Bet kokios su juo susijusios pastabos taipogi bus ten matomos."
text_agenda_item_no_notes: "Pastabos nepateiktos"
text_work_package_has_no_upcoming_meeting_agenda_items: "Šis darbo paketas dar nesuplanuotas artėjančio susitikimo plane."
text_work_package_add_to_meeting_hint: "Naudoite mygtuką „Pridėti į susitikimą“, kad pridėtumėte šį darbo paketą į ateinantį susitikimą."
text_work_package_has_no_past_meeting_agenda_items: "Šis darbo paketas nebuvo paminėtas ankstesniame susitikime."
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module OneDrive
register(:files_info, FilesInfoQuery)
register(:open_link, OpenLinkQuery)
register(:open_drive_link, OpenDriveLinkQuery)
register(:upload_link, UploadLinkQuery)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 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
module OneDrive
class UploadLinkQuery
def initialize(storage)
@storage = storage
@uri = storage.uri
end

def self.call(storage:, user:, data:)
new(storage).call(user:, data:)
end

def call(user:, data:)
folder, filename = data.slice('parent', 'file_name').values

Util.using_user_token(@storage, user) do |token|
response = Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) do |http|
http.post(uri_path_for(folder, filename),
payload(filename),
{ 'Authorization' => "Bearer #{token.access_token}", 'Content-Type' => 'application/json' })
end

handle_response(response)
end
end

private

def payload(filename)
{ item: { "@microsoft.graph.conflictBehavior" => "rename", name: filename } }.to_json
end

def handle_response(response)
case response
when Net::HTTPSuccess
upload_url = MultiJson.load(response.body, symbolize_keys: true)[:uploadUrl]
ServiceResult.success(result: ::Storages::UploadLink.new(URI(upload_url)))
when Net::HTTPNotFound
ServiceResult.failure(result: :not_found, errors: ::Storages::StorageError.new(code: :not_found))
when Net::HTTPUnauthorized
ServiceResult.failure(result: :unauthorized, errors: ::Storages::StorageError.new(code: :unauthorized))
else
ServiceResult.failure(result: :error, errors: ::Storages::StorageError.new(code: :error))
end
end

def uri_path_for(folder, filename)
"/v1.0/drives/#{@storage.drive_id}/items/#{folder}:/#{filename}:/createUploadSession"
end
end
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class StorageFilesAPI < ::API::OpenProjectAPI
case request_body.transform_keys(&:to_sym)
in { projectId: project_id, fileName: file_name, parent: parent }
authorize(:manage_file_links, context: Project.find(project_id))
ServiceResult.success(result: { fileName: file_name, parent: }.transform_keys(&:to_s))
ServiceResult.success(result: { file_name:, parent: }.transform_keys(&:to_s))
else
ServiceResult.failure(errors: Storages::StorageError.new(code: :bad_request, log_message: 'Request body malformed!'))
end
Expand Down
Loading

0 comments on commit c78a7ad

Please sign in to comment.