Skip to content

Commit f01b62f

Browse files
Release OpenProject 17.0.1
2 parents acbb059 + bcd82b6 commit f01b62f

File tree

570 files changed

+657
-396
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

570 files changed

+657
-396
lines changed

.github/workflows/brakeman-scan-core.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
permissions:
1919
contents: read # for actions/checkout to fetch code
2020
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
21-
if: github.repository_owner == 'opf'
21+
if: github.repository == 'opf/openproject'
2222
name: Brakeman Scan
2323
runs-on: ubuntu-latest
2424
env:

.github/workflows/continuous-delivery.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
trigger_downstream_workflow:
1313
permissions:
1414
contents: none
15-
if: github.repository_owner == 'opf'
15+
if: github.repository == 'opf/openproject'
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Trigger Flavours workflow

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ jobs:
116116
docker_tags: ${{ steps.extract_version.outputs.docker_tags }}
117117
registry_image: ${{ steps.extract_version.outputs.registry_image }}
118118
build:
119-
if: github.repository_owner == 'opf'
119+
if: github.repository == 'opf/openproject'
120120
needs:
121121
- setup
122122
runs-on:

.github/workflows/downstream-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
trigger_saas_tests:
2626
permissions:
2727
contents: none
28-
if: github.repository_owner == 'opf'
28+
if: github.repository == 'opf/openproject'
2929
name: SaaS tests
3030
runs-on: ubuntu-latest
3131
steps:

.github/workflows/i18n-tasks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
i18n-tasks:
2424
permissions:
2525
contents: read
26-
if: github.repository_owner == 'opf'
26+
if: github.repository == 'opf/openproject'
2727
name: I18n inconsistency check
2828
runs-on: ubuntu-latest
2929
steps:

.github/workflows/packager.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
build:
14-
if: github.repository_owner == 'opf'
14+
if: github.repository == 'opf/openproject'
1515
name: ${{ matrix.target }}
1616
runs-on: ubuntu-latest
1717
services:

app/contracts/work_package_types/update_form_configuration_contract.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030

3131
module WorkPackageTypes
3232
class UpdateFormConfigurationContract < BaseContract
33+
include RequiresEnterpriseGuard
34+
35+
self.enterprise_action = :edit_attribute_groups
36+
3337
attribute :attribute_groups
3438

3539
validate :validate_attribute_group_names

app/controllers/concerns/accounts/authorization.rb

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@
3333
module Accounts::Authorization
3434
extend ActiveSupport::Concern
3535

36-
METHODS_ENFORCING_AUTHORIZATION = %i[require_admin authorize authorize_global load_and_authorize_in_optional_project].freeze
36+
METHODS_ENFORCING_AUTHORIZATION = %i[
37+
require_admin
38+
authorize
39+
authorize_global
40+
authorize_with_global_permission
41+
load_and_authorize_in_optional_project
42+
load_and_authorize_with_permission_in_project
43+
].freeze
3744

3845
included do
3946
class_attribute :authorization_ensured,
@@ -86,13 +93,14 @@ def load_and_authorize_in_optional_project
8693
# * a parameter-like Hash (eg. { controller: '/projects', action: 'edit' })
8794
# * a permission Symbol (eg. :edit_project)
8895
def do_authorize(action, global: false) # rubocop:disable Metrics/PerceivedComplexity
89-
is_authorized = if global
90-
User.current.allowed_based_on_permission_context?(action)
91-
else
92-
User.current.allowed_based_on_permission_context?(action,
93-
project: @project || @projects,
94-
entity: @work_package || @work_packages)
95-
end
96+
is_authorized =
97+
if global
98+
User.current.allowed_based_on_permission_context?(action)
99+
else
100+
User.current.allowed_based_on_permission_context?(action,
101+
project: @project || @projects,
102+
entity: @work_package || @work_packages)
103+
end
96104

97105
unless is_authorized
98106
if @project&.archived?
@@ -206,14 +214,16 @@ def authorize_with_permission(permission, global: false, **args)
206214
end
207215
end
208216

209-
# Find a project based on params[:project_id]
210-
# and authorize on a given permission
211-
def load_and_authorize_with_permission_in_optional_project(permission, **args)
217+
def authorize_with_global_permission(permission, **args)
218+
authorize_with_permission(permission, global: true, **args)
219+
end
220+
221+
def load_and_authorize_with_permission_in_project(permission, **args)
212222
authorization_checked_by_default_action(**args.slice(:only, :except))
213223

214224
before_action(**args) do
215-
@project = Project.find(params[:project_id]) if params[:project_id].present?
216-
do_authorize(permission, global: params[:project_id].blank?)
225+
@project = Project.find(params[:project_id])
226+
do_authorize(permission, global: false)
217227
end
218228
end
219229
end

app/controllers/groups_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
class GroupsController < ApplicationController
3232
include GroupsHelper
33+
3334
layout "admin"
3435

3536
before_action :require_admin, except: %i[show]
@@ -163,7 +164,7 @@ def group_members
163164
def visible_group_members?
164165
current_user.admin? ||
165166
current_user.allowed_in_any_project?(:manage_members) ||
166-
Group.in_project(Project.allowed_to(current_user, :view_members)).exists?
167+
@group.projects.exists?(id: Project.allowed_to(current_user, :view_members))
167168
end
168169

169170
def respond_membership_altered(service_call)

app/controllers/my/sessions_controller.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@ module My
3232
class SessionsController < ::ApplicationController
3333
before_action :require_login
3434
no_authorization_required! :index,
35-
:show,
3635
:destroy
3736

38-
self._model_object = ::Sessions::UserSession
39-
40-
before_action :find_model_object, only: %i(show destroy)
37+
before_action :load_session, only: %i(destroy)
4138
before_action :prevent_current_session_deletion, only: %i(destroy)
4239

4340
layout "my"
@@ -59,8 +56,6 @@ def index
5956
end
6057
end
6158

62-
def show; end
63-
6459
def destroy
6560
@session.delete
6661

@@ -70,6 +65,10 @@ def destroy
7065

7166
private
7267

68+
def load_session
69+
@session = ::Sessions::UserSession.for_user(current_user).find(params[:id])
70+
end
71+
7372
def prevent_current_session_deletion
7473
if @session.current?(session)
7574
render_400 message: I18n.t("users.sessions.may_not_delete_current")

0 commit comments

Comments
 (0)