Refactor API key authentication to use Catalyst's ActionRole(s) via Does() so that one can attach other roles to various actions as well
Comment out verbose debugging comments
Add table "auth_user_requests" to log all user requests, table "auth_user_request_daily_counts" to log daily request statistics (which can be later converted to weekly statistics), and a database trigger that would log each request to the aggregated "daily counts" table
Add "MediaWords::ActionRole::Logged" action role which will log enabled actions to the "auth_user_requests" table
Use the logging action role in API controller actions, "/search" and "/search/wc"; in "/search", set the "requested" items (stories) to the number of returned stories if "csv=1"
Merge branch 'master' into user_tracking_reporting_throttling
Add index to auth_user_request_daily_counts.email and auth_user_request_daily_counts.day
Create table "auth_user_limits" to store request / requested items limits for authenticated users
Merge branch 'master' into user_tracking_reporting_throttling
Make auth_user_limits.auth_users_id unique because there should be only a single limit set for each user
Rename column to fit better with the rest of the naming scheme
Fetch a list of user roles from the Catalyst's user object
Move reusable helper subroutine to MediaWords::ActionRole::AbstractAuthenticatedActionRole
When not authenticated (either via the API key or normal means), only warn that logging won't be available and don't die()
Add MediaWords::ActionRole::Throttled action role that puts a weekly requests / requested stories limit on configured controller actions
Users belonging to the "admin-readonly" group are also unthrottled
Add ability to manage users' weekly requests / requested items limits via web UI and "mediawords_manage_users.pl" script
Add helper PostgreSQL function "auth_user_limits_weekly_usage(email TEXT)" that will be used in multiple parts of the code to find out the weekly request / requested items usage of the user
Move a list of user roles exempt from the request limits to a separate subroutine
Add "use strict; use warnings;"; remove auto generated comments bloat