It would be useful to have .ini
settings to limit abuse of creating too many tickets or wiki pages. This should be enforced in controllers (including API controller), not in the models (since that could cause trouble for project imports or other server-side scripts or tasks).
Configuration and functionality could be similar to project.rate_limits
. E.g.
forgewiki.rate_limits = {"3600": 100, "172800": 10000} forgetracker.rate_limits = {"3600": 100, "172800": 10000}
Make sure to include a comment like the project.rate_limits
comment in the .ini
sections for these new settings, since it can be a little confusing to know what the numbers are for.
Helper function(s) should be created to check to see if a limit is reached for the given artifact type. Consider factoring out a general purpose rate_limit utility method from plugin.py
's rate_limit
too.
Use ProjectRegistrationProvider.get().registration_date()
for the start date you're comparing to for these cases. To count the number of artifacts, a simple query with app_config_id = c.app.config._id
should be fine (don't need to consider any other tools in the same project)
If an error occurs, show a flash message or API error (HTTP 429) as appropriate, instead of creating the artifact instance. Log a warning.
Closed #789.
ib/7886