Skip to content

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

sort actions guarded in Authorization::EnterpriseService

Ivan Kuchin93de58137811
diff --git a/app/services/authorization/enterprise_service.rb b/app/services/authorization/enterprise_service.rb
index 73a36c2ef60..f07c857f0da 100644
--- a/app/services/authorization/enterprise_service.rb
+++ b/app/services/authorization/enterprise_service.rb
@@ -29,7 +29,7 @@
class Authorization::EnterpriseService
attr_accessor :token
- GUARDED_ACTIONS = %i(
+ GUARDED_ACTIONS = %i[
baseline_comparison
board_view
conditional_highlighting
@@ -37,20 +37,20 @@ class Authorization::EnterpriseService
date_alerts
define_custom_style
edit_attribute_groups
+ gantt_pdf_export
grid_widget_wp_graph
ldap_groups
+ one_drive_sharepoint_file_storage
openid_providers
placeholder_users
+ project_list_sharing
readonly_work_packages
team_planner_view
two_factor_authentication
+ virus_scanning
work_package_query_relation_columns
work_package_sharing
- one_drive_sharepoint_file_storage
- virus_scanning
- gantt_pdf_export
- project_list_sharing
- ).freeze
+ ].freeze
def initialize(token)
self.token = token
diff --git a/spec/services/authorization/enterprise_service_spec.rb b/spec/services/authorization/enterprise_service_spec.rb
index 645415ac054..027e251c235 100644
--- a/spec/services/authorization/enterprise_service_spec.rb
+++ b/spec/services/authorization/enterprise_service_spec.rb
@@ -43,6 +43,14 @@ RSpec.describe Authorization::EnterpriseService do
let(:result) { instance.call(action) }
let(:action) { :an_action }
+ describe "GUARDED_ACTIONS" do
+ it "is in alphabetical order" do
+ guarded_actions = described_class::GUARDED_ACTIONS
+
+ expect(guarded_actions).to eq(guarded_actions.sort)
+ end
+ end
+
describe "#initialize" do
it "has the token" do
expect(instance.token).to eql token