[fix] using proper construct() in other legacy classes

This commit is contained in:
Benjamin Sonntag 2015-01-12 21:54:15 +01:00
parent e3d1a993a1
commit 7511f84720
3 changed files with 1 additions and 31 deletions

View File

@ -15,6 +15,7 @@ class Alternc_Api_Legacyobject {
const ERR_INVALID_ARGUMENT = 111201;
const ERR_ALTERNC_FUNCTION = 111202;
const ERR_NOT_FOUND = 111203;
function __construct($service) {
global $admin, $cuid;

View File

@ -5,21 +5,6 @@
*/
class Alternc_Api_Object_Account extends Alternc_Api_Legacyobject {
const ERR_NOT_FOUND = 1115103;
function __construct($service) {
global $admin, $cuid;
if (!($service instanceof Alternc_Api_Service)) {
throw new \Exception("Bad argument: service is not an Alternc_Api_Service", self::ERR_INVALID_ARGUMENT);
}
// We store the global $cuid to AlternC legacy classes
$this->cuid = $cuid = $service->token->uid;
$this->isAdmin = $service->token->isAdmin;
// We use the global $admin from AlternC legacy classes
$this->admin = $admin;
// Set the legacy rights:
$this->admin->enabled = $this->isAdmin;
}
/** API Method from legacy class method admin->add_mem()
* @param $options a hash with parameters transmitted to legacy call

View File

@ -5,22 +5,6 @@
*/
class Alternc_Api_Object_Policy extends Alternc_Api_Legacyobject {
const ERR_NOT_FOUND = 11151603;
function __construct($service) {
global $admin, $cuid;
if (!($service instanceof Alternc_Api_Service)) {
throw new \Exception("Bad argument: service is not an Alternc_Api_Service", self::ERR_INVALID_ARGUMENT);
}
// We store the global $cuid to AlternC legacy classes
$this->cuid = $cuid = $service->token->uid;
$this->isAdmin = $service->token->isAdmin;
// We use the global $admin from AlternC legacy classes
$this->admin = $admin;
// Set the legacy rights:
$this->admin->enabled = $this->isAdmin;
}
/** API Method from legacy class method admin->editPolicy($policy,$minsize,$maxsize,$classcount,$allowlogin)
* @param $options a hash with parameters transmitted to legacy call
* mandatory parameters: policy minsize maxsize classcount allowlogin