Compare commits

..

1 Commits

Author SHA1 Message Date
birthe 3be039750b correcting outdated email 2 years ago
  1. 1
      .dockerignore
  2. 4
      .github/workflows/brakeman-scan-core.yml
  3. 6
      .github/workflows/codeql-scan-core.yml
  4. 20
      .github/workflows/continuous-delivery.yml
  5. 45
      .github/workflows/create-merge-release-into-dev-pr.yml
  6. 9
      .github/workflows/crowdin.yml
  7. 2
      .github/workflows/docker.yml
  8. 2
      .github/workflows/eslint-core.yml
  9. 2
      .github/workflows/pullpreview.yml
  10. 2
      .github/workflows/rubocop-core.yml
  11. 26
      .github/workflows/test-core.yml
  12. 4
      .gitignore
  13. 10
      .rubocop.yml
  14. 2
      .ruby-version
  15. 2
      COPYRIGHT
  16. 2
      COPYRIGHT_short
  17. 67
      Gemfile
  18. 519
      Gemfile.lock
  19. 2
      Gemfile.modules
  20. 2
      Guardfile
  21. 2
      README.md
  22. 2
      Rakefile
  23. 1
      app/assets/images/enterprise-add-on.svg
  24. 1
      app/assets/images/premium_features.svg
  25. 2
      app/cells/individual_principal_base_filter_cell.rb
  26. 2
      app/cells/members/row_cell.rb
  27. 2
      app/cells/placeholder_users/placeholder_user_filter_cell.rb
  28. 2
      app/cells/placeholder_users/row_cell.rb
  29. 2
      app/cells/placeholder_users/table_cell.rb
  30. 4
      app/cells/projects/table_cell.rb
  31. 2
      app/cells/user_filter_cell.rb
  32. 2
      app/cells/users/user_filter_cell.rb
  33. 2
      app/cells/versions/row_cell.rb
  34. 2
      app/cells/views/individual_principal_base_filter/show.erb
  35. 2
      app/cells/views/projects/row/show.erb
  36. 2
      app/cells/views/projects/table/show.erb
  37. 2
      app/cells/views/row/show.erb
  38. 2
      app/cells/views/table/show.erb
  39. 2
      app/contracts/admin_only_contract.rb
  40. 2
      app/contracts/attachments/create_contract.rb
  41. 2
      app/contracts/attachments/delete_contract.rb
  42. 2
      app/contracts/attachments/prepare_upload_contract.rb
  43. 2
      app/contracts/attachments/validate_replacements.rb
  44. 2
      app/contracts/attribute_help_texts/base_contract.rb
  45. 2
      app/contracts/attribute_help_texts/create_contract.rb
  46. 2
      app/contracts/attribute_help_texts/update_contract.rb
  47. 2
      app/contracts/authentication/omniauth_auth_hash_contract.rb
  48. 2
      app/contracts/backups/create_contract.rb
  49. 4
      app/contracts/base_contract.rb
  50. 2
      app/contracts/concerns/assignable_custom_field_values.rb
  51. 9
      app/contracts/concerns/requires_admin_guard.rb
  52. 8
      app/contracts/concerns/requires_enterprise_guard.rb
  53. 2
      app/contracts/concerns/single_table_inheritance_model_contract.rb
  54. 2
      app/contracts/concerns/unchanged_project.rb
  55. 2
      app/contracts/custom_actions/cu_contract.rb
  56. 2
      app/contracts/custom_actions/execute_contract.rb
  57. 2
      app/contracts/custom_fields/base_contract.rb
  58. 2
      app/contracts/custom_fields/create_contract.rb
  59. 2
      app/contracts/custom_fields/update_contract.rb
  60. 2
      app/contracts/delete_contract.rb
  61. 2
      app/contracts/empty_contract.rb
  62. 2
      app/contracts/groups/base_contract.rb
  63. 2
      app/contracts/groups/create_contract.rb
  64. 2
      app/contracts/groups/delete_contract.rb
  65. 2
      app/contracts/groups/update_contract.rb
  66. 2
      app/contracts/journals/update_contract.rb
  67. 2
      app/contracts/members/base_contract.rb
  68. 2
      app/contracts/members/create_contract.rb
  69. 2
      app/contracts/members/delete_contract.rb
  70. 2
      app/contracts/members/update_contract.rb
  71. 2
      app/contracts/messages/base_contract.rb
  72. 2
      app/contracts/messages/create_contract.rb
  73. 2
      app/contracts/messages/update_contract.rb
  74. 7
      app/contracts/model_contract.rb
  75. 2
      app/contracts/notifications/create_contract.rb
  76. 2
      app/contracts/oauth/application_contract.rb
  77. 3
      app/contracts/oauth_clients/create_contract.rb
  78. 2
      app/contracts/oauth_clients/delete_contract.rb
  79. 2
      app/contracts/params_contract.rb
  80. 2
      app/contracts/placeholder_users/base_contract.rb
  81. 2
      app/contracts/placeholder_users/create_contract.rb
  82. 2
      app/contracts/placeholder_users/delete_contract.rb
  83. 2
      app/contracts/placeholder_users/update_contract.rb
  84. 42
      app/contracts/projects/archive_contract.rb
  85. 33
      app/contracts/projects/archiver.rb
  86. 27
      app/contracts/projects/base_contract.rb
  87. 2
      app/contracts/projects/copy_contract.rb
  88. 2
      app/contracts/projects/create_contract.rb
  89. 2
      app/contracts/projects/delete_contract.rb
  90. 2
      app/contracts/projects/enabled_modules_contract.rb
  91. 11
      app/contracts/projects/unarchive_contract.rb
  92. 10
      app/contracts/projects/update_contract.rb
  93. 2
      app/contracts/queries/base_contract.rb
  94. 2
      app/contracts/queries/copy_contract.rb
  95. 2
      app/contracts/queries/create_contract.rb
  96. 2
      app/contracts/queries/update_contract.rb
  97. 2
      app/contracts/queries/update_form_contract.rb
  98. 2
      app/contracts/relations/base_contract.rb
  99. 2
      app/contracts/relations/create_contract.rb
  100. 2
      app/contracts/relations/delete_contract.rb
  101. Some files were not shown because too many files have changed in this diff Show More

@ -26,6 +26,7 @@ features
help
log/*.log
spec
spec_legacy
tmp
frontend/node_modules
node_modules

@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
@ -38,6 +38,6 @@ jobs:
brakeman -i config/brakeman.ignore -f sarif -o output.sarif.json .
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: output.sarif.json

@ -24,12 +24,12 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v1

@ -14,25 +14,13 @@ jobs:
if: github.repository == 'opf/openproject'
runs-on: ubuntu-latest
steps:
- name: Trigger SaaS workflow
- name: Trigger downstream workflow
env:
TOKEN: ${{ secrets.OPENPROJECT_CI_TOKEN }}
REPOSITORY: opf/saas-openproject
WORKFLOW_ID: continuous-delivery-saas.yml
SAAS_CD_WORKFLOW_ID: continuous-delivery-saas.yml
SAAS_REPOSITORY: opf/saas-openproject
run: |
curl -i --fail -H"authorization: Bearer $TOKEN" \
-XPOST -H"Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$REPOSITORY/actions/workflows/$WORKFLOW_ID/dispatches \
https://api.github.com/repos/$SAAS_REPOSITORY/actions/workflows/$SAAS_CD_WORKFLOW_ID/dispatches \
-d '{"ref": "${{ github.ref }}"}'
- name: Trigger Flavours workflow
env:
TOKEN: ${{ secrets.OPENPROJECT_CI_TOKEN }}
REPOSITORY: opf/openproject-flavours
WORKFLOW_ID: ci.yml
CORE_REF: ${{ github.ref }}
run: |
curl -i --fail -H"authorization: Bearer $TOKEN" \
-XPOST -H"Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$REPOSITORY/actions/workflows/$WORKFLOW_ID/dispatches \
-d '{"ref": "master", "inputs": { "ref" : "$CORE_REF" }}'

@ -1,45 +0,0 @@
name: create-merge-release-into-dev-pr
on:
workflow_dispatch:
permissions: {}
jobs:
setup:
runs-on: ubuntu-latest
outputs:
latest_release_branch: ${{ steps.find_latest_release.outputs.branch }}
steps:
- id: find_latest_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
BRANCH=$(curl -H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/$GITHUB_REPOSITORY/branches?protected=true | \
jq -r .[].name | grep "release/" | sort --reverse | head -1
)
if [ "$BRANCH" = "" ]; then
echo "Invalid release branch found: $BRANCH"
exit 1
fi
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
crowdin:
permissions:
contents: write # for git push
runs-on: ubuntu-latest
needs: setup
timeout-minutes: 5
steps:
- name: create pull request
run: gh pr create \
--base $BASE_BRANCH \
--head $RELEASE_BRANCH \
--title "Merge $RELEASE_BRANCH into $BASE_BRANCH" \
--body 'Created by GitHub action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_BRANCH: dev
RELEASE_BRANCH: ${{ needs.setup.outputs.latest_release_branch }}

@ -25,7 +25,8 @@ jobs:
exit 1
fi
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
echo "::set-output name=branch::${BRANCH}"
echo "::set-output name=crowdin_release_branch::release"
crowdin:
permissions:
@ -41,7 +42,7 @@ jobs:
- dev
- "${{ needs.setup.outputs.latest_release_branch }}"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
fetch-depth: 1
@ -53,9 +54,9 @@ jobs:
run: |
echo "Setting crowdin branch from $BRANCH"
if [ "$BRANCH" = "dev" ]; then
echo "crowdin_branch=dev" >> $GITHUB_OUTPUT
echo "::set-output name=crowdin_branch::dev"
else
echo "crowdin_branch=release" >> $GITHUB_OUTPUT
echo "::set-output name=crowdin_branch::release"
fi
- name: "Updating translations"
uses: crowdin/github-action@1.4.4

@ -19,7 +19,7 @@ jobs:
env:
INPUT_BUILDOPTIONS: --pull
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@master
- name: Prepare docker files
run: |
cp ./docker/prod/Dockerfile ./Dockerfile

@ -14,7 +14,7 @@ jobs:
name: eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: opf/action-eslint@v2

@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Generate .env.pullpreview file
run: |
echo "OP_ADMIN_USER_SEEDER_FORCE_PASSWORD_CHANGE=off" >> .env.pullpreview

@ -13,7 +13,7 @@ jobs:
name: rubocop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: ruby/setup-ruby@v1

@ -28,15 +28,15 @@ jobs:
CI_RETRY_COUNT: 3
LOCAL_DEV_CHECK: 1
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: cache
uses: actions/cache@v3
uses: actions/cache@v2
with:
path: /tmp/cache
key: ${{ runner.os }}-ruby32-core-tests-units-${{ hashFiles('**/Gemfile.lock') }}
key: ${{ runner.os }}-ruby31-core-tests-units-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-ruby32-core-tests-units-
${{ runner.os }}-ruby32-core-tests-
${{ runner.os }}-ruby31-core-tests-units-
${{ runner.os }}-ruby31-core-tests-
- name: test
run: |
docker-compose -f docker-compose.ci.yml build --pull ci
@ -58,15 +58,15 @@ jobs:
CAPYBARA_AWS_ACCESS_KEY_ID: "${{ secrets.CAPYBARA_AWS_ACCESS_KEY_ID }}"
CAPYBARA_AWS_SECRET_ACCESS_KEY: "${{ secrets.CAPYBARA_AWS_SECRET_ACCESS_KEY }}"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: cache
uses: actions/cache@v3
uses: actions/cache@v2
with:
path: /tmp/cache
key: ${{ runner.os }}-ruby32-core-tests-features-${{ hashFiles('**/Gemfile.lock') }}
key: ${{ runner.os }}-ruby31-core-tests-features-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-ruby32-core-tests-features-
${{ runner.os }}-ruby32-core-tests-
${{ runner.os }}-ruby31-core-tests-features-
${{ runner.os }}-ruby31-core-tests-
- name: test
run: |
docker-compose -f docker-compose.ci.yml build --pull ci
@ -80,12 +80,12 @@ jobs:
name: APIv3 specification (OpenAPI 3.0)
if: github.repository == 'opf/openproject'
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/setup-node@v3
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: ./script/api/validate_spec

4
.gitignore vendored

@ -44,9 +44,6 @@ npm-debug.log*
# Ignore Visual Studio Code files
/.vscode
# Ignore Vim backup files
*~
# Ignore Ctags files
/tags
/tags.lock
@ -135,4 +132,3 @@ structure.sql
# lefthook.yml user override
lefthook-local.yml
frontend/package-lock.json

@ -1,7 +1,6 @@
require:
- rubocop-rails
- rubocop-rspec
- ./lib_static/rubocop/cop/open_project/no_do_end_block_with_rspec_capybara_matcher_in_expect.rb
- ./lib_static/rubocop/cop/open_project/use_service_result_factory_methods.rb
inherit_mode:
@ -10,7 +9,7 @@ inherit_mode:
- Exclude
AllCops:
TargetRubyVersion: 3.2
TargetRubyVersion: 3.1
# Enable any new cops in new versions by default
NewCops: enable
Exclude:
@ -223,14 +222,13 @@ RSpec/NamedSubject:
RSpec/ContextWording:
Prefixes:
- as
- for
- if
- 'on'
- to
- unless
- when
- with
- without
- if
- unless
- for
RSpec/FactoryBot/SyntaxMethods:
Enabled: true

@ -1 +1 @@
3.2.0
3.1.2

@ -1,6 +1,6 @@
OpenProject is an open source project management software.
Copyright (C) 2012-2023 the OpenProject GmbH
Copyright (C) 2012-2022 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

@ -1,5 +1,5 @@
OpenProject is an open source project management software.
Copyright (C) 2012-2023 the OpenProject GmbH
Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.
@ -28,7 +28,7 @@
source 'https://rubygems.org'
ruby '~> 3.2.0'
ruby '~> 3.1.2'
gem 'actionpack-xml_parser', '~> 2.0.0'
gem 'activemodel-serializers-xml', '~> 1.0.1'
@ -39,8 +39,6 @@ gem 'responders', '~> 3.0'
gem 'ffi', '~> 1.15'
gem 'mail', '~> 2.8.0'
gem 'rdoc', '>= 2.4.2'
gem 'doorkeeper', '~> 5.5.0'
@ -54,9 +52,9 @@ gem 'warden-basic_auth', '~> 0.2.1'
gem 'will_paginate', '~> 3.3.0'
gem 'friendly_id', '~> 5.5.0'
gem 'friendly_id', '~> 5.4.0'
gem 'acts_as_list', '~> 1.1.0'
gem 'acts_as_list', '~> 1.0.1'
gem 'acts_as_tree', '~> 2.9.0'
gem 'awesome_nested_set', '~> 3.5.0'
gem 'closure_tree', '~> 7.4.0'
@ -80,7 +78,7 @@ gem 'htmldiff'
gem 'stringex', '~> 2.8.5'
# CommonMark markdown parser with GFM extension
gem 'commonmarker', '~> 0.23.7'
gem 'commonmarker', '~> 0.23.6'
# HTML pipeline for transformations on text formatter output
# such as sanitization or additional features
@ -90,9 +88,9 @@ gem 'deckar01-task_list', '~> 2.3.1'
# Requires escape-utils for faster escaping
gem 'escape_utils', '~> 1.3'
# Syntax highlighting used in html-pipeline with rouge
gem 'rouge', '~> 4.0.0'
gem 'rouge', '~> 3.30.0'
# HTML sanitization used for html-pipeline
gem 'sanitize', '~> 6.0.1'
gem 'sanitize', '~> 6.0.0'
# HTML autolinking for mails and urls (replaces autolink)
gem 'rinku', '~> 2.0.4'
# Version parsing with semver
@ -116,13 +114,13 @@ gem 'posix-spawn', '~> 0.3.13', require: false
gem 'bcrypt', '~> 3.1.6'
gem 'multi_json', '~> 1.15.0'
gem 'oj', '~> 3.14.0'
gem 'oj', '~> 3.13.0'
gem 'daemons'
gem 'delayed_cron_job', '~> 0.9.0'
gem 'delayed_job_active_record', '~> 4.1.5'
gem 'rack-protection', '~> 3.0.0'
gem 'rack-protection', '~> 2.2.0'
# Rack::Attack is a rack middleware to protect your web app from bad clients.
# It allows whitelisting, blacklisting, throttling, and tracking based
@ -153,13 +151,13 @@ gem 'airbrake', '~> 13.0.0', require: false
gem 'prawn', '~> 2.2'
gem 'prawn-markup', '~> 0.3.0'
# prawn implicitly depends on matrix gem no longer in ruby core with 3.1
# prawn implictly depends on matrix gem no longer in ruby core with 3.1
gem 'matrix', '~> 0.4.2'
gem 'cells-erb', '~> 0.1.0'
gem 'cells-rails', '~> 0.1.4'
gem 'meta-tags', '~> 2.18.0'
gem 'meta-tags', '~> 2.17.0'
gem "paper_trail", "~> 12.3"
@ -175,11 +173,11 @@ 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.0'
gem 'puma-plugin-statsd', '~> 2.0'
gem 'puma', '~> 5.6'
gem 'rack-timeout', '~> 0.6.3', require: "rack/timeout/base"
gem 'puma-plugin-statsd', '~> 2.0'
gem 'nokogiri', '~> 1.14.0'
gem 'nokogiri', '~> 1.13.4'
gem 'carrierwave', '~> 1.3.1'
gem 'carrierwave_direct', '~> 2.1.0'
@ -197,10 +195,15 @@ gem 'rest-client', '~> 2.0'
gem 'ruby-progressbar', '~> 1.11.0', require: false
gem 'mini_magick', '~> 4.12.0', require: false
gem 'mini_magick', '~> 4.11.0', require: false
gem 'validate_url'
# Sentry error reporting
gem "sentry-delayed_job", '~> 5.4.0'
gem "sentry-rails", '~> 5.4.0'
gem "sentry-ruby", '~> 5.4.0'
# Appsignal integration
gem "appsignal", "~> 3.0", require: false
@ -211,12 +214,13 @@ group :test do
# Test prof provides factories from code
# and other niceties
gem 'test-prof', '~> 1.1.0'
gem 'test-prof', '~> 1.0.0'
gem 'database_cleaner', '~> 2.0'
gem 'rack_session_access'
gem 'rspec', '~> 3.12.0'
gem 'rspec', '~> 3.11.0'
# also add to development group, so "spec" rake task gets loaded
gem 'rspec-rails', '~> 6.0.0', group: :development
gem 'rspec-rails', '6.0.0.rc1', group: :development
# Retry failures within the same environment
gem 'retriable', '~> 3.1.1'
@ -228,10 +232,10 @@ group :test do
# brings back testing for 'assigns' and 'assert_template' extracted in rails 5
gem 'rails-controller-testing', '~> 1.0.2'
gem 'capybara', '~> 3.38.0'
gem 'capybara', '~> 3.37.0'
gem 'capybara-screenshot', '~> 1.0.17'
gem 'selenium-webdriver', '~> 4.0'
gem 'webdrivers', '~> 5.2.0'
gem 'webdrivers', '~> 5.0.0'
gem 'fuubar', '~> 2.5.0'
gem 'timecop', '~> 0.9.0'
@ -247,7 +251,7 @@ group :test do
gem 'json_spec', '~> 1.1.4'
gem 'shoulda-matchers', '~> 5.0', require: nil
gem 'parallel_tests', '~> 4.0'
gem 'parallel_tests', '~> 3.1'
end
group :ldap do
@ -255,8 +259,9 @@ group :ldap do
end
group :development do
gem 'listen', '~> 3.8.0' # Use for event-based reloaders
gem 'listen', '~> 3.7.0' # Use for event-based reloaders
gem 'faker'
gem 'letter_opener'
gem 'spring'
@ -280,12 +285,10 @@ group :development, :test do
gem 'ruby-prof', require: false
gem 'stackprof', require: false
# REPL with debug commands
gem 'debug'
gem 'pry-byebug', '~> 3.10.0', platforms: [:mri]
gem 'pry-byebug', '~> 3.9.0', platforms: [:mri]
gem 'pry-rails', '~> 0.3.6'
gem 'pry-rescue', '~> 1.5.2'
gem 'pry-stack_explorer', '~> 0.6.0'
# ruby linting
gem 'rubocop', require: false
@ -296,16 +299,16 @@ group :development, :test do
gem 'lefthook', require: false
# Brakeman scanner
gem 'brakeman', '~> 5.4.0'
gem 'brakeman', '~> 5.3.0'
gem 'danger-brakeman'
end
gem 'bootsnap', '~> 1.16.0', require: false
gem 'bootsnap', '~> 1.13.0', require: false
# API gems
gem 'grape', '~> 1.7.0'
gem 'grape', '~> 1.6.0'
gem 'grape_logging', '~> 1.8.4'
gem 'roar', '~> 1.2.0'
gem 'roar', '~> 1.1.0'
# CORS for API
gem 'rack-cors', '~> 1.1.1'

File diff suppressed because it is too large Load Diff

@ -14,7 +14,7 @@ gem 'omniauth-openid_connect-providers',
gem 'omniauth-openid-connect',
git: 'https://github.com/opf/omniauth-openid-connect.git',
ref: '0d2cd71'
ref: 'e1173e682a60010c018146443453560a13b01a90'
group :opf_plugins do
# included so that engines can reference OpenProject::Version

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2020 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.

@ -10,7 +10,7 @@ OpenProject is a web-based project management software. Its key features are:
* [Product roadmap and release planning](https://www.openproject.org/collaboration-software-features/#product-management)
* [Task management and team collaboration](https://www.openproject.org/collaboration-software-features/#task-management)
* [Agile and Scrum](https://www.openproject.org/collaboration-software-features/#agile-scrum)
* [Time tracking, cost reporting, and budgeting](https://www.openproject.org/collaboration-software-features/#time-tracking)
* [Time tracking, cost reporting and budgeting](https://www.openproject.org/collaboration-software-features/#time-tracking)
* [Bug tracking](https://www.openproject.org/collaboration-software-features/#bug-tracking)
* [Wikis](https://www.openproject.org/docs/user-guide/wysiwyg/)
* [Forums](https://www.openproject.org/docs/user-guide/forums/)

@ -1,7 +1,7 @@
#!/usr/bin/env rake
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 9.3 KiB

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><defs><style>.cls-1{fill:#9fcde0;}.cls-1,.cls-3{stroke:#0070ba;}.cls-1,.cls-5{stroke-miterlimit:10;}.cls-1,.cls-3,.cls-4{stroke-width:10px;}.cls-2,.cls-3,.cls-4{fill:#fff;}.cls-3,.cls-4{stroke-linecap:round;stroke-linejoin:round;}.cls-4,.cls-5{stroke:#66cb92;}.cls-5{fill:none;stroke-width:7px;stroke-dasharray:20.32 32.51;}.cls-6{fill:#66cb92;}</style></defs><g id="Ebene_1" data-name="Ebene 1"><path class="cls-1" d="M217.55,873.35,313.26,850l27.65,94.54a12.74,12.74,0,0,0,23.27,2.79l329.2-570.2L532.71,284.4,203.5,854.6A12.74,12.74,0,0,0,217.55,873.35Z"/><path class="cls-1" d="M782.45,873.35,686.74,850l-27.65,94.54a12.74,12.74,0,0,1-23.27,2.79l-329.2-570.2L467.29,284.4,796.5,854.6A12.74,12.74,0,0,1,782.45,873.35Z"/><path class="cls-2" d="M818.63,444.45l-.14.1a58.26,58.26,0,0,0-19,71l0,.06a58.26,58.26,0,0,1-47.27,81.78h0a58.26,58.26,0,0,0-52.06,52.06h0a58.25,58.25,0,0,1-81.78,47.26l-.06,0a58.26,58.26,0,0,0-71,19l-.1.14a58.25,58.25,0,0,1-94.4,0l-.1-.14a58.26,58.26,0,0,0-71-19l-.06,0a58.25,58.25,0,0,1-81.78-47.26h0a58.26,58.26,0,0,0-52.06-52.06h0a58.26,58.26,0,0,1-47.27-81.78l0-.06a58.26,58.26,0,0,0-19-71l-.14-.1a58.26,58.26,0,0,1,0-94.41l.14-.1a58.25,58.25,0,0,0,19-71l0-.05a58.27,58.27,0,0,1,47.27-81.79h0a58.26,58.26,0,0,0,52.06-52h0a58.26,58.26,0,0,1,81.78-47.27l.06,0a58.26,58.26,0,0,0,71-19l.1-.14a58.25,58.25,0,0,1,94.4,0l.1.14a58.26,58.26,0,0,0,71,19l.06,0A58.26,58.26,0,0,1,700.17,145h0a58.26,58.26,0,0,0,52.06,52h0a58.27,58.27,0,0,1,47.27,81.79l0,.05a58.25,58.25,0,0,0,19,71l.14.1A58.26,58.26,0,0,1,818.63,444.45Z"/><path class="cls-3" d="M818.63,444.45l-.14.1a58.26,58.26,0,0,0-19,71l0,.06a58.26,58.26,0,0,1-47.27,81.78h0a58.26,58.26,0,0,0-52.06,52.06h0a58.25,58.25,0,0,1-81.78,47.26l-.06,0a58.26,58.26,0,0,0-71,19l-.1.14a58.25,58.25,0,0,1-94.4,0l-.1-.14a58.26,58.26,0,0,0-71-19l-.06,0a58.25,58.25,0,0,1-81.78-47.26h0a58.26,58.26,0,0,0-52.06-52.06h0a58.26,58.26,0,0,1-47.27-81.78l0-.06a58.26,58.26,0,0,0-19-71l-.14-.1a58.26,58.26,0,0,1,0-94.41l.14-.1a58.25,58.25,0,0,0,19-71l0-.05a58.27,58.27,0,0,1,47.27-81.79h0a58.26,58.26,0,0,0,52.06-52h0a58.26,58.26,0,0,1,81.78-47.27l.06,0a58.26,58.26,0,0,0,71-19l.1-.14a58.25,58.25,0,0,1,94.4,0l.1.14a58.26,58.26,0,0,0,71,19l.06,0A58.26,58.26,0,0,1,700.17,145h0a58.26,58.26,0,0,0,52.06,52h0a58.27,58.27,0,0,1,47.27,81.79l0,.05a58.25,58.25,0,0,0,19,71l.14.1A58.26,58.26,0,0,1,818.63,444.45Z"/><circle class="cls-4" cx="500" cy="397.25" r="239.31"/><circle class="cls-5" cx="500" cy="397.25" r="193.4"/><path class="cls-6" d="M535.36,356.58l93.49,3.69a4.79,4.79,0,0,1,2.63,8.65L555.86,424l25.37,90.06a4.78,4.78,0,0,1-7.41,5.17l-75.76-54.9-77.81,52a4.78,4.78,0,0,1-7.21-5.45l28.8-89-73.46-57.94a4.78,4.78,0,0,1,2.95-8.54l93.57-.12,32.4-87.77a4.78,4.78,0,0,1,9,.17Z"/></g></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2020 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.

@ -76,7 +76,7 @@ module Members
end
def may_update?
table.authorize_update
!principal&.admin && table.authorize_update
end
def may_delete?

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2020 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2020 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2020 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.

@ -88,7 +88,7 @@ module Projects
def custom_field_columns
project_custom_fields.values.map do |custom_field|
[custom_field.column_name.to_sym, { caption: custom_field.name, custom_field: true }]
[:"cf_#{custom_field.id}", { caption: custom_field.name, custom_field: true }]
end
end
@ -102,7 +102,7 @@ module Projects
end
fields
.index_by { |cf| cf.column_name.to_sym }
.index_by { |cf| :"cf_#{cf.id}" }
end
end
end

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2020 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2020 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 2012-2023 the OpenProject GmbH
Copyright (C) 2012-2020 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.

@ -1,6 +1,6 @@
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 2012-2023 the OpenProject GmbH
Copyright (C) 2012-2020 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.

@ -1,6 +1,6 @@
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 2012-2023 the OpenProject GmbH
Copyright (C) 2012-2020 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.

@ -1,6 +1,6 @@
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 2012-2023 the OpenProject GmbH
Copyright (C) 2012-2020 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.

@ -1,6 +1,6 @@
<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) 2012-2023 the OpenProject GmbH
Copyright (C) 2012-2020 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.
@ -227,7 +227,7 @@ class BaseContract < Disposable::Twin
end
if model.respond_to?(:available_custom_fields)
writable += model.available_custom_fields.map(&:attribute_name)
writable += model.available_custom_fields.map { |cf| "custom_field_#{cf.id}" }
end
writable

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.
@ -30,11 +30,12 @@ module RequiresAdminGuard
extend ActiveSupport::Concern
included do
validate :validate_admin_only
validate { validate_admin_only(user, errors) }
end
# Adds an error if user is archived or not an admin.
def validate_admin_only
module_function
def validate_admin_only(user, errors)
unless user.admin? && user.active?
errors.add :base, :error_unauthorized
end

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.
@ -31,16 +31,14 @@ module RequiresEnterpriseGuard
included do
class_attribute :enterprise_action
class_attribute :enterprise_condition
# Validate when no enterprise_condition is set, or when it evaluates to true
validate :has_enterprise, if: -> { enterprise_condition.nil? || instance_exec(&enterprise_condition) }
validate :has_enterprise
end
module_function
def has_enterprise
unless EnterpriseToken.allows_to?(enterprise_action)
errors.add :base, :error_enterprise_only, action: enterprise_action.to_s.titleize
errors.add :base, :error_enterprise_only
end
end
end

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.
@ -77,9 +77,6 @@ class ModelContract < BaseContract
end
def changed_by_user
return model.changed_by_user if model.respond_to?(:changed_by_user)
return model.changed_with_custom_fields if model.respond_to?(:changed_with_custom_fields)
model.changed
model.respond_to?(:changed_by_user) ? model.changed_by_user : model.changed
end
end

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.
@ -29,6 +29,7 @@
module OAuthClients
class CreateContract < ::ModelContract
include ActiveModel::Validations
include ActiveModel::Validations
attribute :client_id, writable: true
validates :client_id, presence: true, length: { maximum: 255 }

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.
@ -27,44 +27,16 @@
#++
module Projects
class ArchiveContract < ::BaseContract
class ArchiveContract < ModelContract
include RequiresAdminGuard
include Projects::Archiver
validate :validate_no_foreign_wp_references
validate :validate_has_archive_project_permission
protected
# Check that there is no wp of a non descendant project that is assigned
# to one of the project or descendant versions
def validate_no_foreign_wp_references
version_ids = model.rolled_up_versions.select(:id)
exists = WorkPackage
.where.not(project_id: model.self_and_descendants.select(:id))
.exists?(version_id: version_ids)
errors.add :base, :foreign_wps_reference_version if exists
end
def validate_has_archive_project_permission
validate_can_archive_project
validate_can_archive_subprojects
end
def validate_can_archive_project
return if user.allowed_to?(:archive_project, model)
errors.add :base, :error_unauthorized
end
def validate_can_archive_subprojects
# prevent adding another error if there is already one present
return if errors.present?
subprojects = model.descendants
return if subprojects.empty?
return if user.allowed_to?(:archive_project, subprojects)
errors.add :base, :archive_permission_missing_on_subprojects
def validate_model?
false
end
end
end

@ -26,26 +26,25 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'rspec/mocks'
module Projects
module Archiver
# Check that there is no wp of a non descendant project that is assigned
# to one of the project or descendant versions
def validate_no_foreign_wp_references
version_ids = model.rolled_up_versions.select(:id)
module RSpec
module Mocks
class Proxy
# Backport rspec/rspec-mocks#1508 for ruby 3.2 compatibility until a new
# version of rspec-mocks is released
#
# Delete this file if using rspec-mocks version > 3.12.1. The fix will
# probably be included.
ruby2_keywords :record_message_received
exists = WorkPackage
.where.not(project_id: model.self_and_descendants.select(:id))
.where(version_id: version_ids)
.exists?
errors.add :base, :foreign_wps_reference_version if exists
end
class VerifyingMethodDouble
# Backport rspec/rspec-mocks#1502 for ruby 3.2 compatibility until a new
# version of rspec-mocks is released
#
# Delete this file if using rspec-mocks version > 3.12.1. The fix will
# probably be included.
ruby2_keywords :proxy_method_invoked
def validate_all_ancestors_active
if model.ancestors.any?(&:archived?)
errors.add :base, :archived_ancestor
end
end
end
end

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.
@ -30,6 +30,7 @@ module Projects
class BaseContract < ::ModelContract
include AssignableValuesContract
include AssignableCustomFieldValues
include Projects::Archiver
attribute :name
attribute :identifier
@ -89,7 +90,9 @@ module Projects
def validate_user_allowed_to_manage
with_unchanged_id do
errors.add :base, :error_unauthorized unless user.allowed_to?(manage_permission, model)
with_active_assumed do
errors.add :base, :error_unauthorized unless user.allowed_to?(manage_permission, model)
end
end
end
@ -116,14 +119,26 @@ module Projects
model.id = project_id
end
def with_active_assumed
active = model.active
model.active = true
yield
ensure
model.active = active
end
def validate_changing_active
return unless model.active_changed?
contract_klass = model.being_archived? ? ArchiveContract : UnarchiveContract
contract = contract_klass.new(model, user)
contract.validate
RequiresAdminGuard.validate_admin_only(user, errors)
errors.merge!(contract.errors)
if model.active?
# switched to active -> unarchiving
validate_all_ancestors_active
else
validate_no_foreign_wp_references
end
end
end
end

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.
@ -27,17 +27,16 @@
#++
module Projects
class UnarchiveContract < ::BaseContract
class UnarchiveContract < ModelContract
include RequiresAdminGuard
include Projects::Archiver
validate :validate_all_ancestors_active
protected
def validate_all_ancestors_active
if model.ancestors.any?(&:archived?)
errors.add :base, :archived_ancestor
end
def validate_model?
false
end
end
end

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.
@ -31,13 +31,7 @@ module Projects
private
def manage_permission
if changed_by_user == ["active"]
:archive_project
else
# if "active" is changed, :archive_project permission will also be
# checked in `Projects::BaseContract#validate_changing_active`
:edit_project
end
:edit_project
end
end
end

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

@ -1,6 +1,6 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
# Copyright (C) 2012-2022 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.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save