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

use OpenProject::Token.lowest_plan_for directly

Ivan Kuchin7f90670bafac
diff --git a/app/models/enterprise_token.rb b/app/models/enterprise_token.rb
index 4b371f1f282..809cbc579ab 100644
--- a/app/models/enterprise_token.rb
+++ b/app/models/enterprise_token.rb
@@ -31,12 +31,6 @@ class EnterpriseToken < ApplicationRecord
EXPIRING_SOON_DAYS = 30
class << self
- def get_feature_plan(feature)
- OpenProject::Token::FEATURES_PER_PLAN.find do |_plan, features|
- features.include?(feature.to_sym)
- end&.first
- end
-
def all_tokens
all.sort_by(&:sort_key)
end
diff --git a/config/initializers/scimitar.rb b/config/initializers/scimitar.rb
index c1c296cc723..ecfa267b9ad 100644
--- a/config/initializers/scimitar.rb
+++ b/config/initializers/scimitar.rb
@@ -36,7 +36,7 @@ Rails.application.config.to_prepare do
Scimitar.engine_configuration = Scimitar::EngineConfiguration.new(
custom_authenticator: lambda do
if !EnterpriseToken.allows_to?(:scim_api)
- plan = EnterpriseToken.get_feature_plan(:scim_api)
+ plan = OpenProject::Token.lowest_plan_for(:scim_api)
error = Scimitar::ErrorResponse.new(
status: 403,
detail: "This endpoint requires an enterprise subscription of at least #{plan}"