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

Rename limit_condition -> discriminator

Oliver Günther24af9f96b5d7
diff --git a/lib/open_project/rate_limiting/api_v3.rb b/lib/open_project/rate_limiting/api_v3.rb
index c184f97fd60..121811517d8 100644
--- a/lib/open_project/rate_limiting/api_v3.rb
+++ b/lib/open_project/rate_limiting/api_v3.rb
@@ -15,7 +15,7 @@ module OpenProject
protected
- def limit_condition(req)
+ def discriminator(req)
if req.post? && req.path.start_with?('/api/v3/') && req.path.end_with?('/form')
session_id(req.env) || http_auth(req.env)
end
diff --git a/lib/open_project/rate_limiting/base.rb b/lib/open_project/rate_limiting/base.rb
index 4dd292a1668..bef7ca87c06 100644
--- a/lib/open_project/rate_limiting/base.rb
+++ b/lib/open_project/rate_limiting/base.rb
@@ -27,7 +27,7 @@ module OpenProject
def apply!
Rack::Attack.throttle(rule_name, limit:, period:) do |request|
- limit_condition(request)
+ discriminator(request)
end
self
@@ -86,7 +86,7 @@ module OpenProject
false
end
- def limit_condition(request)
+ def discriminator(request)
raise NotImplementedError
end
diff --git a/lib/open_project/rate_limiting/lost_password.rb b/lib/open_project/rate_limiting/lost_password.rb
index 59a5dbfd8ea..51916ec4a30 100644
--- a/lib/open_project/rate_limiting/lost_password.rb
+++ b/lib/open_project/rate_limiting/lost_password.rb
@@ -21,7 +21,7 @@ module OpenProject
false
end
- def limit_condition(req)
+ def discriminator(req)
if req.post? && req.path.end_with?('/account/lost_password')
req.env.dig "rack.request.form_hash", "mail"
end