Adding User or Device Limits ACME Subscription
<?php
/**
* Acme subscription class.
*
* @category apps
* @package acme
* @subpackage libraries
* @author ClearFoundation <developer@clearfoundation.com>
* @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 <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// 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 <developer@clearfoundation.com>
* @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;
}
}
search?q=clearos%2C%20clearos%20content%2C%20dev%2C%20framework%2C%20tutorial%2C%20adding%20user%20or%20device%20limits%2C%20acme%2C%20maintainer_dloper&btnI=lucky