made can_manage() abstract in baseModule to save memory

This commit is contained in:
Roland Gruber 2014-04-20 12:59:36 +00:00
parent 58dead0b75
commit 6cd040e9c1
11 changed files with 104 additions and 27 deletions

View File

@ -4,7 +4,7 @@ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2003 - 2006 Tilo Lutz
2005 - 2013 Roland Gruber
2005 - 2014 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -38,6 +38,15 @@ $Id$
*/
class account extends baseModule {
/**
* Returns true if this module can manage accounts of the current type, otherwise false.
*
* @return boolean true if module fits
*/
public function can_manage() {
return in_array($this->get_scope(), array("host", "user"));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -52,8 +61,6 @@ class account extends baseModule {
$return = array();
// icon
$return['icon'] = 'uid.png';
// manages host accounts
$return["account_types"] = array("host", "user");
// alias name
$return["alias"] = _('Account');
// this is a base module

View File

@ -52,6 +52,15 @@ class asteriskAccount extends baseModule implements passwordService {
$this->autoAddObjectClasses = false;
}
/**
* Returns true if this module can manage accounts of the current type, otherwise false.
*
* @return boolean true if module fits
*/
public function can_manage() {
return in_array($this->get_scope(), array('user'));
}
/**
* Returns meta data that is interpreted by parent class.
*
@ -59,8 +68,6 @@ class asteriskAccount extends baseModule implements passwordService {
*/
function get_metaData() {
$return = array();
// manages users accounts
$return["account_types"] = array("user");
$return["is_base"] = false;
// alias name
$return["alias"] = _("Asterisk");

View File

@ -54,6 +54,15 @@ class asteriskExtension extends baseModule {
/** flag if new rule should be added */
private $addRuleFlag = false;
/**
* Returns true if this module can manage accounts of the current type, otherwise false.
*
* @return boolean true if module fits
*/
public function can_manage() {
return in_array($this->get_scope(), array('asteriskExt'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -61,8 +70,6 @@ class asteriskExtension extends baseModule {
*/
function get_metaData() {
$return = array();
// manages users accounts
$return["account_types"] = array("asteriskExt");
$return["is_base"] = true;
// RDN attribute
$return["RDN"] = array("cn" => "normal");

View File

@ -50,6 +50,15 @@ class asteriskVoicemail extends baseModule implements passwordService {
$this->autoAddObjectClasses = false;
}
/**
* Returns true if this module can manage accounts of the current type, otherwise false.
*
* @return boolean true if module fits
*/
public function can_manage() {
return in_array($this->get_scope(), array('user'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -57,8 +66,6 @@ class asteriskVoicemail extends baseModule implements passwordService {
*/
function get_metaData() {
$return = array();
// manages users accounts
$return["account_types"] = array("user");
$return["is_base"] = false;
// alias name
$return["alias"] = _("Asterisk voicemail");

View File

@ -4,7 +4,7 @@ $Id$
This code is not yet part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2011 J de Jong
2012 - 2013 Roland Gruber
2012 - 2014 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -49,7 +49,16 @@ class authorizedServiceObject extends baseModule {
}
/**
/**
* Returns true if this module can manage accounts of the current type, otherwise false.
*
* @return boolean true if module fits
*/
public function can_manage() {
return in_array($this->get_scope(), array('user'));
}
/**
* Returns meta data that is interpreted by parent class
*
* @return array array with meta data
@ -58,8 +67,6 @@ class authorizedServiceObject extends baseModule {
$return = array();
// icon
$return['icon'] = 'services.png';
// manages user accounts
$return["account_types"] = array("user");
// alias name
$return["alias"] = _("Authorized Services");
// module dependencies

View File

@ -4,7 +4,7 @@ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2008 Thomas Manninger
2008 - 2013 Roland Gruber
2008 - 2014 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -43,6 +43,15 @@ class ddns extends baseModule {
public $ddns = array();
/**
* Returns true if this module can manage accounts of the current type, otherwise false.
*
* @return boolean true if module fits
*/
public function can_manage() {
return in_array($this->get_scope(), array('dhcp'));
}
/**
* Returns meta data that is interpreted by parent class.
*
@ -50,8 +59,6 @@ class ddns extends baseModule {
*/
public function get_metaData() {
$return = array();
// manages host accounts
$return["account_types"] = array("dhcp");
// alias name
$return["alias"] = _("DDNS");
// this is a base module

View File

@ -4,7 +4,7 @@ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2008 Thomas Manninger
2008 - 2013 Roland Gruber
2008 - 2014 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -107,6 +107,15 @@ class dhcp_settings extends baseModule {
parent::__construct($scope);
}
/**
* Returns true if this module can manage accounts of the current type, otherwise false.
*
* @return boolean true if module fits
*/
public function can_manage() {
return in_array($this->get_scope(), array('dhcp'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -114,8 +123,6 @@ class dhcp_settings extends baseModule {
*/
public function get_metaData() {
$return = array();
// manages host accounts
$return["account_types"] = array("dhcp");
// alias name
$return["alias"] = _("DHCP settings");
// this is a base module

View File

@ -48,6 +48,15 @@ class eduPerson extends baseModule {
$this->autoAddObjectClasses = false;
}
/**
* Returns true if this module can manage accounts of the current type, otherwise false.
*
* @return boolean true if module fits
*/
public function can_manage() {
return in_array($this->get_scope(), array('user'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -59,8 +68,6 @@ class eduPerson extends baseModule {
$return = array();
// icon
$return['icon'] = 'eduPerson.png';
// manages host accounts
$return["account_types"] = array("user");
// alias name
$return["alias"] = _("EDU person");
// module dependencies

View File

@ -58,6 +58,15 @@ class fixed_ip extends baseModule {
/** cached host entries (list of array('cn' => ..., 'iphostnumber' => ..., 'macaddress' => ...)) */
private $hostCache = null;
/**
* Returns true if this module can manage accounts of the current type, otherwise false.
*
* @return boolean true if module fits
*/
public function can_manage() {
return in_array($this->get_scope(), array('dhcp'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -67,8 +76,6 @@ class fixed_ip extends baseModule {
*/
public function get_metaData() {
$return = array();
// manages host accounts
$return["account_types"] = array("dhcp");
// alias name
$return["alias"] = _("Hosts");
// this is a base module

View File

@ -50,6 +50,15 @@ class freeRadius extends baseModule {
$this->autoAddObjectClasses = false;
}
/**
* Returns true if this module can manage accounts of the current type, otherwise false.
*
* @return boolean true if module fits
*/
public function can_manage() {
return in_array($this->get_scope(), array('user'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -61,8 +70,6 @@ class freeRadius extends baseModule {
$return = array();
// icon
$return['icon'] = 'freeRadius.png';
// manages user accounts
$return["account_types"] = array("user");
// alias name
$return["alias"] = _("FreeRadius");
// module dependencies

View File

@ -34,6 +34,15 @@ $Id$
*/
class generalInformation extends baseModule {
/**
* Returns true if this module can manage accounts of the current type, otherwise false.
*
* @return boolean true if module fits
*/
public function can_manage() {
return in_array($this->get_scope(), getTypes());
}
/**
* Returns meta data that is interpreted by parent class
*
@ -45,8 +54,6 @@ class generalInformation extends baseModule {
$return = array();
// icon
$return['icon'] = 'info.png';
// manages all accounts
$return["account_types"] = getTypes();
// alias name
$return["alias"] = _("General information");
// module dependencies