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
Extract restricted boards check into a `before_action` hook
Aaron Contrerasf82d2e3588cb
diff --git a/modules/boards/app/controllers/boards/boards_controller.rb b/modules/boards/app/controllers/boards/boards_controller.rbindex ca006393cb3..900e7e412be 100644--- a/modules/boards/app/controllers/boards/boards_controller.rb+++ b/modules/boards/app/controllers/boards/boards_controller.rb@@ -13,6 +13,7 @@ module ::Boardsendbefore_action :authorize_global, only: %i[overview new create]+ before_action :ensure_board_type_not_restricted, only: %i[create]menu_item :board_view@@ -37,8 +38,6 @@ module ::Boardsdef new; enddef create- return render_403 if restricted_board_type?-service_result = service_call@board_grid = service_result.result@@ -64,6 +63,10 @@ module ::Boards@board_grid = Boards::Grid.newend+ def ensure_board_type_not_restricted+ render_403 if restricted_board_type?+ end+def restricted_board_type?!EnterpriseToken.allows_to?(:board_view) && board_grid_params[:attribute] != 'basic'end