InformaticsMatters / fragnet

Fragment network tooling
Apache License 2.0
1 stars 0 forks source link

Limit searches #17

Open tdudgeon opened 4 years ago

tdudgeon commented 4 years ago

Allow to limit the number of searches that can be executed by a user. Users would belong to a particular tier with each tier having a specified number of searches that can be performed in a 30 day period. e.g. platinum=unlimited, gold=2500, silver=500, bronze/evaluation=50

  1. Create a mechanism for defining the tier and expiry period in Keycloak and reading that info into the search app.
  2. Implement counting queries in the search app, including reading historical once from the query logs.
  3. Provide API for a client to fetch the tier and query counts.
  4. Prevent queries being executed if none are remaining.
tdudgeon commented 4 years ago

This commit implements point 3 and most of point 2. https://github.com/InformaticsMatters/fragnet/commit/f9fc83b43b08650a0b15bcb71eec885176d3eccb

@alanbchristie Could you look into implementing reading the query logs as I'm not sure which ones will exist. We'll need to keep all logs in place for a period of at least 30 days, and be able to restore those log files if we redeploy. The point to read the data is here: https://github.com/InformaticsMatters/fragnet/blob/f9fc83b43b08650a0b15bcb71eec885176d3eccb/fragnet-search/src/main/java/org/squonk/fragnet/service/AbstractFragnetSearchRouteBuilder.java#L36 and this test shows how to read a log file: https://github.com/InformaticsMatters/fragnet/blob/f9fc83b43b08650a0b15bcb71eec885176d3eccb/fragnet-search/src/test/groovy/org/squonk/fragnet/account/AccountDataSpec.groovy