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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Use new permission in schedule controller
Oliver Günther5e5fa5f37e6e
diff --git a/app/controllers/concerns/accounts/authorization.rb b/app/controllers/concerns/accounts/authorization.rbindex a45f130a49d..93320f71eb1 100644--- a/app/controllers/concerns/accounts/authorization.rb+++ b/app/controllers/concerns/accounts/authorization.rb@@ -85,7 +85,7 @@ module Accounts::Authorization# Action can be:# * a parameter-like Hash (eg. { controller: '/projects', action: 'edit' })# * a permission Symbol (eg. :edit_project)- def do_authorize(action, global: false)+ def do_authorize(action, global: false) # rubocop:disable Metrics/PerceivedComplexityis_authorized = if globalUser.current.allowed_based_on_permission_context?(action)elsediff --git a/modules/meeting/app/controllers/recurring_meetings/schedule_controller.rb b/modules/meeting/app/controllers/recurring_meetings/schedule_controller.rbindex 8c8b842494c..d85ad73a1e6 100644--- a/modules/meeting/app/controllers/recurring_meetings/schedule_controller.rb+++ b/modules/meeting/app/controllers/recurring_meetings/schedule_controller.rb@@ -1,9 +1,6 @@module RecurringMeetingsclass ScheduleController < ApplicationController- before_action do- do_authorize :create_meetings, global: true- end- authorization_checked! :humanize_schedule+ authorize_with_permission :create_meetings, global: truearound_action :with_user_time_zonebefore_action :build_meetingdiff --git a/spec/controllers/concerns/authorization_spec.rb b/spec/controllers/concerns/authorization_spec.rbindex dcf42dde898..60e4aa61807 100644--- a/spec/controllers/concerns/authorization_spec.rb+++ b/spec/controllers/concerns/authorization_spec.rb@@ -115,7 +115,7 @@ RSpec.describe ApplicationController, "enforcement of authorization" do # rubocoauthorize_with_permission :view_project- def do_authorize(_permission, global: false)+ def do_authorize(*)trueendend@@ -142,7 +142,7 @@ RSpec.describe ApplicationController, "enforcement of authorization" do # rubocorender plain: "OK"end- def do_authorize(_permission, global: true)+ def do_authorize(*)trueendend@@ -172,7 +172,7 @@ RSpec.describe ApplicationController, "enforcement of authorization" do # rubocoload_and_authorize_with_permission_in_optional_project :view_project- def do_authorize(_permission, global: true)+ def do_authorize(*)trueendend@@ -209,7 +209,7 @@ RSpec.describe ApplicationController, "enforcement of authorization" do # rubocorender plain: "OK"end- def do_authorize(_permission, global: true)+ def do_authorize(*)trueendend