made can_manage() abstract in baseModule to save memory

This commit is contained in:
Roland Gruber 2014-04-20 13:00:42 +00:00
parent 6cd040e9c1
commit 11e6a3fb66
29 changed files with 265 additions and 62 deletions

View File

@ -45,6 +45,15 @@ class hostObject 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
*
@ -56,8 +65,6 @@ class hostObject extends baseModule {
$return = array();
// icon
$return['icon'] = 'computer.png';
// manages host accounts
$return["account_types"] = array("user");
// alias name
$return["alias"] = _("Hosts");
// module dependencies

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2004 - 2013 Roland Gruber
Copyright (C) 2004 - 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
@ -34,6 +34,15 @@ $Id$
*/
class ieee802device 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'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -45,8 +54,6 @@ class ieee802device extends baseModule {
$return = array();
// icon
$return['icon'] = 'network-wired.png';
// manages host accounts
$return["account_types"] = array("host");
// alias name
$return["alias"] = _("MAC address");
// module dependencies

View File

@ -41,6 +41,15 @@ class imapAccess extends baseModule {
/** quota limit from profile */
private $profileQuotaLimit = 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('user'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -50,8 +59,6 @@ class imapAccess extends baseModule {
*/
function get_metaData() {
$return = array();
// manages user accounts
$return["account_types"] = array("user");
// alias name
$return["alias"] = _("Mailbox");
// module dependencies

View File

@ -34,6 +34,15 @@ $Id$
*/
class inetLocalMailRecipient 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
*
@ -45,8 +54,6 @@ class inetLocalMailRecipient extends baseModule {
$return = array();
// icon
$return['icon'] = 'mailBig.png';
// manages host accounts
$return["account_types"] = array("user");
// alias name
$return["alias"] = _("Mail routing");
// module dependencies

View File

@ -106,6 +106,15 @@ class inetOrgPerson extends baseModule implements passwordService {
$this->messages['sendPasswordMail'][0] = array('ERROR', _('Account %s:') . ' inetOrgPerson_sendPasswordMail', _('This value can only be "true" or "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
*
@ -117,8 +126,6 @@ class inetOrgPerson extends baseModule implements passwordService {
$return = array();
// icon
$return['icon'] = 'uid.png';
// manages user accounts
$return["account_types"] = array("user");
// alias name
$return["alias"] = _('Personal');
// this is a base module

View File

@ -50,6 +50,15 @@ class kolabGroup 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('group'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -61,8 +70,6 @@ class kolabGroup extends baseModule {
$return = array();
// icon
$return['icon'] = 'kolab.png';
// manages host accounts
$return["account_types"] = array('group');
// alias name
$return["alias"] = _("Kolab");
// module dependencies

View File

@ -58,6 +58,15 @@ class kolabSharedFolder extends baseModule { // TODO folder type
);
}
/**
* 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('kolabSharedFolderType'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -69,8 +78,6 @@ class kolabSharedFolder extends baseModule { // TODO folder type
$return = array();
// icon
$return['icon'] = 'kolab.png';
// manages host accounts
$return["account_types"] = array('kolabSharedFolderType');
// alias name
$return["alias"] = _("Kolab shared folder");
// this is a base module

View File

@ -56,6 +56,15 @@ class kolabUser 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
*
@ -67,8 +76,6 @@ class kolabUser extends baseModule {
$return = array();
// icon
$return['icon'] = 'kolab.png';
// manages host accounts
$return["account_types"] = array("user");
// alias name
$return["alias"] = _("Kolab");
// module dependencies

View File

@ -38,6 +38,15 @@ class ldapPublicKey extends baseModule {
/** session variable for existing keys in self service */
const SESS_KEY_LIST = 'ldapPublicKey_keyList';
/**
* 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
*
@ -49,8 +58,6 @@ class ldapPublicKey extends baseModule {
$return = array();
// icon
$return['icon'] = 'keyBig.png';
// manages host accounts
$return["account_types"] = array("user");
// alias name
$return["alias"] = _("SSH public key");
// module dependencies

View File

@ -41,6 +41,15 @@ class nisMailAlias extends baseModule {
/** display limit */
const DISPLAY_LIMIT = 50;
/**
* 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('mailAlias'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -52,8 +61,6 @@ class nisMailAlias extends baseModule {
$return = array();
// icon
$return['icon'] = 'mailBig.png';
// manages host accounts
$return["account_types"] = array("mailAlias");
// base module
$return["is_base"] = true;
// LDAP filter

View File

@ -46,6 +46,15 @@ class nisMailAliasUser extends baseModule {
/** alias entries to extend with new recipients (list of arrays: dn => recipients) */
private $recipientsToAdd = 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('user'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -57,8 +66,6 @@ class nisMailAliasUser extends baseModule {
$return = array();
// icon
$return['icon'] = 'mailBig.png';
// manages host accounts
$return["account_types"] = array("user");
// alias name
$return["alias"] = _("Mail aliases");
// module dependencies

View File

@ -43,6 +43,15 @@ class nisnetgroup extends baseModule {
/** group cache */
private $cachedGroupList = 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('netgroup'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -54,8 +63,6 @@ class nisnetgroup extends baseModule {
$return = array();
// icon
$return['icon'] = 'groupBig.png';
// manages netgroup accounts
$return["account_types"] = array('netgroup');
// alias name
$return["alias"] = _("NIS net group");
// this is a base module

View File

@ -131,6 +131,15 @@ class posixAccount extends baseModule implements passwordService {
$this->messages['sambaIDPoolDN'][0] = array('ERROR', _('Samba ID pool DN'), _('This is not a valid DN!'));
}
/**
* 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', 'host'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -142,8 +151,6 @@ class posixAccount extends baseModule implements passwordService {
$return = array();
// icon
$return['icon'] = 'tux.png';
// manages user and host accounts
$return["account_types"] = array("user", "host");
// user specific data
if ($this->get_scope() == "user") {
// LDAP filter

View File

@ -345,6 +345,15 @@ class posixGroup extends baseModule implements passwordService {
return $return;
}
/**
* 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('group'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -354,8 +363,6 @@ class posixGroup extends baseModule implements passwordService {
$return = array();
// icon
$return['icon'] = 'tux.png';
// manages group accounts
$return["account_types"] = array("group");
if ($this->get_scope() == "group") {
// this is a base module
$return["is_base"] = true;

View File

@ -3,7 +3,7 @@
$Id$
This code is not yet part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2012 - 2013 Roland Gruber
Copyright (C) 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
@ -48,7 +48,16 @@ class puppetClient 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'));
}
/**
* Returns meta data that is interpreted by parent class
*
* @return array array with meta data
@ -57,8 +66,6 @@ class puppetClient extends baseModule {
$return = array();
// icon
$return['icon'] = 'puppet.png';
// manages user accounts
$return["account_types"] = array("host");
// alias name
$return["alias"] = _("Puppet");
// module dependencies

View File

@ -37,6 +37,15 @@ class pykotaBillingCode extends baseModule {
/** cache for existing codes (array(dn1 => pykotaBillingCode1, dn2 => pykotaBillingCode2)) */
private $codeCache = 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('pykotaBillingCodeType'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -48,8 +57,6 @@ class pykotaBillingCode extends baseModule {
$return = array();
// icon
$return['icon'] = 'printerBig.png';
// manages host accounts
$return["account_types"] = array('pykotaBillingCodeType');
// alias name
$return["alias"] = _("PyKota");
// this is a base module

View File

@ -69,6 +69,15 @@ class pykotaGroup extends baseModule {
$this->autoAddObjectClasses = $this->isStructural();
}
/**
* 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('group'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -80,8 +89,6 @@ class pykotaGroup extends baseModule {
$return = array();
// icon
$return['icon'] = 'printerBig.png';
// manages host accounts
$return["account_types"] = array('group');
// alias name
$return["alias"] = _("PyKota");
// this is a base module

View File

@ -55,6 +55,15 @@ class pykotaPrinter 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('pykotaPrinterType'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -66,8 +75,6 @@ class pykotaPrinter extends baseModule {
$return = array();
// icon
$return['icon'] = 'printerBig.png';
// manages host accounts
$return["account_types"] = array('pykotaPrinterType');
// alias name
$return["alias"] = _("PyKota");
// this is a base module

View File

@ -69,6 +69,15 @@ class pykotaUser extends baseModule {
$this->autoAddObjectClasses = $this->isStructural();
}
/**
* 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
*
@ -80,8 +89,6 @@ class pykotaUser extends baseModule {
$return = array();
// icon
$return['icon'] = 'printerBig.png';
// manages host accounts
$return["account_types"] = array('user');
// alias name
$return["alias"] = _("PyKota");
// this is a base module

View File

@ -63,6 +63,15 @@ class quota extends baseModule {
$this->messages['upload'][0] = array('ERROR', _('Account %s:') . ' %s', _('Quota has wrong format!'));
}
/**
* 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', 'group'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -74,8 +83,6 @@ class quota extends baseModule {
$return = array();
// icon
$return['icon'] = 'hard-driveBig.png';
// manages user and group accounts
$return["account_types"] = array("user", "group");
// alias name
$return["alias"] = _('Quota');
if ($this->get_scope() == 'group') {

View File

@ -52,6 +52,15 @@ class range extends baseModule {
/** For check, if IPs overlaped. */
public $overlaped;
/**
* 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
*
@ -61,8 +70,6 @@ class range extends baseModule {
*/
public function get_metaData() {
$return = array();
// manages dhcp accounts
$return["account_types"] = array("dhcp");
// alias name
$return["alias"] = _("Ranges");
// this is a base module

View File

@ -34,6 +34,15 @@ $Id$
*/
class sambaDomain 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('smbDomain'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -45,8 +54,6 @@ class sambaDomain extends baseModule {
$return = array();
// icon
$return['icon'] = 'samba.png';
// manages host accounts
$return["account_types"] = array("smbDomain");
// alias name
$return["alias"] = _("Samba domain");
// 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) 2003 - 2006 Tilo Lutz
2007 - 2013 Roland Gruber
2007 - 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
@ -77,6 +77,15 @@ class sambaGroupMapping 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('group'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -88,8 +97,6 @@ class sambaGroupMapping extends baseModule {
$return = array();
// icon
$return['icon'] = 'samba.png';
// manages group accounts
$return["account_types"] = array("group");
// alias name
$return["alias"] = _('Samba 3');
// module dependencies

View File

@ -122,6 +122,15 @@ class sambaSamAccount extends baseModule implements passwordService {
$this->messages['profileCanMustChange'][0] = array('ERROR', _('The value for the Samba 3 field "User can/must change password" needs to be a number.'));
}
/**
* 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', 'host'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -133,8 +142,6 @@ class sambaSamAccount extends baseModule implements passwordService {
$return = array();
// icon
$return['icon'] = 'samba.png';
// manages user and host accounts
$return["account_types"] = array("user", "host");
// alias name
$return["alias"] = _('Samba 3');
// RDN attribute

View File

@ -67,6 +67,15 @@ class shadowAccount extends baseModule implements passwordService {
$this->messages['shadow_expireDate'][0] = array('ERROR', _('Account %s:') . ' shadowAccount_expireDate', _('The expiration date is invalid.'));
}
/**
* 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
*
@ -78,8 +87,6 @@ class shadowAccount extends baseModule implements passwordService {
$return = array();
// icon
$return['icon'] = 'keyBig.png';
// manages user accounts
$return["account_types"] = array("user");
// alias name
$return["alias"] = _('Shadow');
// module dependencies

View File

@ -34,6 +34,15 @@ $Id$
*/
class systemQuotas 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
*
@ -45,8 +54,6 @@ class systemQuotas extends baseModule {
$return = array();
// icon
$return['icon'] = 'hard-driveBig.png';
// manages host accounts
$return["account_types"] = array('user');
// alias name
$return["alias"] = _("Quota");
// module dependencies

View File

@ -69,6 +69,15 @@ class windowsGroup 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('group'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -80,8 +89,6 @@ class windowsGroup extends baseModule {
$return = array();
// icon
$return['icon'] = 'samba.png';
// manages host accounts
$return["account_types"] = array('group');
// this is a base module
$return["is_base"] = true;
// RDN attribute

View File

@ -34,6 +34,15 @@ $Id$
*/
class windowsHost 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'));
}
/**
* Returns meta data that is interpreted by parent class
*
@ -45,8 +54,6 @@ class windowsHost extends baseModule {
$return = array();
// icon
$return['icon'] = 'samba.png';
// manages host accounts
$return["account_types"] = array('host');
// this is a base module
$return["is_base"] = true;
// RDN attribute

View File

@ -57,6 +57,15 @@ class windowsUser extends baseModule implements passwordService {
private $clearTextPassword;
/**
* 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
*
@ -68,8 +77,6 @@ class windowsUser extends baseModule implements passwordService {
$return = array();
// icon
$return['icon'] = 'samba.png';
// manages user accounts
$return["account_types"] = array('user');
// this is a base module
$return["is_base"] = true;
// PHP extensions