Developers Documentation

×

Warning

301 error for file:https://clearos.com/dokuwiki2/lib/exe/css.php?t=dokuwiki&tseed=82873f9c9a1f5784b951644363f20ef8

User Tools

Site Tools


Adding User or Device Limits Multiple Tiers

This document outlines how to implement user limits for a paid app with multiple tiers (e.g. free and paid). If you have a simple paid app with no tiers, you can jump straight to the Simple Paid App example.

Acme Home, Business and Enterprise

With the simple paid app example under your belt, we can move to a more complex scenario. In this example, the Acme app comes in three different versions:

  • Acme Home - free for up to 10 users
  • Acme Business - $50 / year for up to 50 users
  • Acme Enterprise - $200 / year for over 50 users

In your app development tree, four different apps are going to be created - one for each of the above versions along with an app to hold some common libraries and assets.

  • acme
  • acme_home
  • acme_business
  • acme_enterprise

Subscription Engine Class

Each of the Acme apps will need to implement a Subscription Class, so a generic Acme_Subscription_Engine library is used as a base class. It's nearly identical to the simple paid app example.

Each of the Acme tiers then extend the engine library (full code here), so the pertinent part of the Acme_Home_Subscription.php class looks like:

    public function __construct()
    {
        clearos_profile(__METHOD__, __LINE__);
 
        parent::__construct(lang('acme_home_app_name'));
    }

You can certainly shuffle things around or override the get_info() method… that is up to you.

Configlet

content/en_us/dev_framework_tutorials_adding_user_or_device_limits_multiple_tiers.txt · Last modified: 2015/03/01 17:50 (external edit)

https://clearos.com/dokuwiki2/lib/exe/indexer.php?id=content%3Aen_us%3Adev_framework_tutorials_adding_user_or_device_limits_multiple_tiers&1710834086