The following tutorial provides information on how to integrate an app that requires user or device limits. For example, you may want to provide a free version of a paid app, but limit the version to 10 users. The details on such an implementation are provided below.
There are two layers to providing user/device limits on an app:
The convenience layer is an open source hook into the user/device system that provides useful license information to a ClearOS administrator. When an administrator hits or approaches a user/device limit:
As an app developer, you don't have to worry about the details of the user/device manager web interface, the framework handles it for you.
Since the convenience layer is open source, it is trivial to circumvent. To address this pitfall, an additional proprietary verification layer provides a way to verify app limits in a way that is difficult to disable. Commercial apps like Zarafa Small Business already include license engines, so this layer is already implemented in some cases.
With the basic understanding of the two layers under your belt, let's move on to the implementation overview. When it comes right down to the bottom line, the convenience layer requires a class with a single get_info() method that returns the following information:
|Limit type||User or Device|
|Total||Total number included in the app, e.g. 10 users|
|Used||Total number in use, e.g. 3|
|Available||Total number available, e.g. 7|
|User Limits||User limit information for extensions/plugins|
With this get_info() method in place, the user/device system is able to manage thresholds. The screenshot below is an example warning message in the Users app when the 10-user limit has been reached:
For digging deeper into the implementation details, we have two examples available:
Even if you plan on developing an app with different payment tiers, we recommend skimming over the first Simple Paid App example.