How to limit the activation of a node to a time period
Last updated
Last updated
This article discusses a very specific use-case requested by a customer. It is not a common scenario and should only be used in the context of the specific requirements outlined below. The approach described here is not the typical way QLM handles expiry dates and floating licenses.
This article was published merely to illustrate the extent of the QLM API.
A customer purchases n licenses of your product. You want to allow the customer to install as many copies of your product as needed on his systems. In order to run your application, user A needs to activate a license. Once activated, 1 / n licenses is consumed. The license that is allocated to user A is allocated for a specific period, say 1 week. After 1 week, user A is no longer able to use your application without requesting an extension. If no extension is requested, the license is then available for user B to consume.
If user A requests an extension, user A can continue using your application for another period.
The implementation of this model relies on the usage of the UserData field that is associated with each license in the QLM database.
When implementing this solution, you need to consider 2 types of licenses. Single activation license keys and multiple activation license keys. This is required because QLM stores information about licenses differently for single activation keys v/s multiple activation keys. To determine if a license is a multiple activation key, you need to check the value of . If the value is 1, the license is a single activation license. If the value is greater than 1, the license is a multiple-activation license. Note that you must call QlmLicense.ValidateLicense with the activation key before calling .
Whenever a license is activated, the application will write the following information to the QLM UserData field by calling . Note that if you are using the UserData field for other purposes, you should always call first and then update it as needed.
Additionally, the application will write the expiry date to the end user system by calling
Every time the application starts up, the application will call to retrieve the expiry date of the license. If the license has expired, the application will exit.
If a user tries to activate a license and it fails because no more licenses are available, it will attempt to deactivate the previous license if it has expired. To do so, the application will:
Call to retrieve the expiry date
Determine if the license has expired.
If it has, call to clear the expiry date.
Call (URL, activationKey, computerID, ...) to deactivate the previous node.
To request an extension to a license, you would:
If an application tries to activate a license and fails because no more licenses are available, it will attempt to deactivate all licenses that have expired. To do so, the application will:
Call GetActivationLog to retrieve the list of all activated nodes.
Loop through the list of activated nodes and determine which licenses have expired.
To request an extension to a license, you would:
Call with a new expiry date
Call with the new expiry date.
Whenever a license is activated, the application will write the following information to the QLM UserData field by calling . Note that if you are using the UserData field for other purposes, you should always call first and then update it as needed.
Additionally, the application will write the expiry date to the end user system by calling
Every time the application starts up, the application will call to retrieve the expiry date of the license. If the license has expired, the application will exit.
Remove the expired nodes from the list by calling (URL, activationKey, computerID, ...) for each node that has expired.
Call with a new expiry date
Call with the new expiry date.