keygen-sh / keygen-api

Keygen is a fair source software licensing and distribution API built with Ruby on Rails. For developers, by developers.
https://keygen.sh
Other
699 stars 40 forks source link

Add a PER_USER leasing strategy to policies #831

Closed ezekg closed 1 month ago

ezekg commented 2 months ago

To enforce process limits on a per-user basis. Should only be applied when the process's machine has an owner.

ezekg commented 1 month ago

When leasing strategy is set to PER_USER, max machines and max processes should both be per-user.

So it'd look like this:

ezekg commented 1 month ago

How do we handle null machine owners? Should we add a requireMachineOwner attribute that must be enabled before a PER_USER leasing strategy can be used? Or should a null owner be considered a unique user? I lean more towards the latter because I'd like to avoid yet another attribute on the policy object.

ezekg commented 1 month ago

Some things that will need to be adjusted for the PER_USER leasing strategy:

  1. Machine limits need to scope per-user, not just per-license, both during machine creation and validations.
  2. Ditto for core limits.

These are not simple changes, but shouldn't be too complex.