ClearOS 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 ACME Subscription

<?php
 
/**
 * Acme subscription class.
 *
 * @category   apps
 * @package    acme
 * @subpackage libraries
 * @author     ClearFoundation 
 * @copyright  2013 ClearFoundation
 * @license    http://www.gnu.org/copyleft/lgpl.html GNU Lesser General Public License version 3 or later
 * @link       http://www.clearfoundation.com/docs/developer/apps/acme/
 */
 
///////////////////////////////////////////////////////////////////////////////
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see .
//
///////////////////////////////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////////////////////////////
// N A M E S P A C E
///////////////////////////////////////////////////////////////////////////////
 
namespace clearos\apps\acme;
///////////////////////////////////////////////////////////////////////////////
// B O O T S T R A P
///////////////////////////////////////////////////////////////////////////////
 
$bootstrap = getenv('CLEAROS_BOOTSTRAP') ? getenv('CLEAROS_BOOTSTRAP') : '/usr/clearos/framework/shared';
require_once $bootstrap . '/bootstrap.php';
 
///////////////////////////////////////////////////////////////////////////////
// T R A N S L A T I O N S
///////////////////////////////////////////////////////////////////////////////
 
clearos_load_language('acme');
 
///////////////////////////////////////////////////////////////////////////////
// D E P E N D E N C I E S
///////////////////////////////////////////////////////////////////////////////
 
use \clearos\apps\clearcenter\Subscription_Engine as Subscription_Engine;
 
clearos_load_library('clearcenter/Subscription_Engine');
 
///////////////////////////////////////////////////////////////////////////////
// C L A S S
///////////////////////////////////////////////////////////////////////////////
 
/**
 * Acme subscription class.
 *
 * @category   apps
 * @package    acme
 * @subpackage libraries
 * @author     ClearFoundation 
 * @copyright  2013 ClearFoundation
 * @license    http://www.gnu.org/copyleft/lgpl.html GNU Lesser General Public License version 3 or later
 * @link       http://www.clearfoundation.com/docs/developer/apps/acme/
 */
 
class Acme_Subscription extends Subscription_Engine
{
    ///////////////////////////////////////////////////////////////////////////////
    // M E T H O D S
    ///////////////////////////////////////////////////////////////////////////////
 
    /**
     * Acme subscription constructor.
     */
 
    public function __construct()
    {
        clearos_profile(__METHOD__, __LINE__);
    }
 
    /**
     * Returns subscription information.
     *
     * @return array subscription information
     *
     * @throws Engine_Exception
     */
 
    public function get_info()
    {
        clearos_profile(__METHOD__, __LINE__);
 
        // Fill in the total, used and available data with actual data.
 
        $info = array(
            'app_name' => lang('acme_app_name'),
            'type' => Subscription_Engine::TYPE_USER,
            'total' => 10,
            'used' => 10,
            'available' => 0,
        );
 
        // The Acme app uses an LDAP extension: acme_extension. For the 
        // "User" app, we specify the attribute that should be disabled 
        // once the limit has been reached.
 
        $info['user_limit']['extension']['acme'] = array('account_flag');
 
        return $info;
    }
}
content/en_us/dev_framework_tutorials_adding_user_or_device_limits_acme_subscription.txt · Last modified: 2014/12/23 15:33 by dloper

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