support splitted dhcpService/dhcpServer entries

This commit is contained in:
Roland Gruber 2013-02-23 17:10:43 +00:00
parent 89c5fa950c
commit a8730fa790
10 changed files with 41 additions and 29 deletions

View File

@ -2,6 +2,7 @@ March 2013 4.1
- updated EDU person module (RFE 3599128)
- Personal: allow management of user certificates (RFE 1753030)
- Unix: Support Samba Unix Id pool for automatic UID/GID generation
- DHCP: support separated dhcpServer and dhcpService entries
- LAM Pro:
-> support Qmail groups
- fixed bugs:

View File

@ -3116,8 +3116,13 @@ Have fun!
<para>You can mange your DHCP server with LAM. It supports to manage
subnets, fixed IP entries, IP ranges and DDNS. The DHCP can be activated
by adding the account type DHCP to your server profile. Please also add
the DHCP modules. LAM requires that you use an LDAP entry with the
object class "dhcpServer" as suffix for this account type.</para>
the DHCP modules.</para>
<para>LAM requires that you use an LDAP entry with the object class
"dhcpService" or "dhcpServer" as suffix for this account type. If the
"dhcpServer" entry points to a "dhcpService" entry via "dhcpServiceDN"
then you need to use the DN of the "dhcpService" entry as LDAP suffix
for DHCP.</para>
<literallayout>
</literallayout>
@ -3208,7 +3213,8 @@ Run slapindex to rebuild the index.
</literallayout></para>
<para>You can manage the settings of your DHCP server entry:</para>
<para>You can manage the settings of your DHCP service/server
entry:</para>
<screenshot>
<mediaobject>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -1643,7 +1643,7 @@ class accountContainer {
for ($j=0; $j<count($ops); $j++) {
$attrs = array_keys($temp[$DNs[$i]][$ops[$j]]);
for ($k=0; $k<count($attrs); $k++) {
$attributes[$DNs[$i]][$ops[$j]][$attrs[$k]] = array_unique($attributes[$DNs[$i]][$ops[$j]][$attrs[$k]]);
$attributes[$DNs[$i]][$ops[$j]][$attrs[$k]] = array_values(array_unique($attributes[$DNs[$i]][$ops[$j]][$attrs[$k]]));
}
}
}

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 - 2012 Roland Gruber
2008 - 2013 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,19 +43,6 @@ class ddns extends baseModule {
public $ddns = array();
/**
* Initializes the module after it became part of an {@link accountContainer}
*
* Calling this method requires the existence of an enclosing {@link accountContainer}.
*
* @param string $base the name of the {@link accountContainer} object ($_SESSION[$base])
*/
public function init($base) {
parent::init($base);
$this->attributes = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes;
$this->orig = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->orig;
}
/**
* Returns meta data that is interpreted by parent class.
*
@ -168,7 +155,7 @@ class ddns extends baseModule {
public function module_complete() {
if ($this->getAccountContainer()->dn_orig==$_SESSION['config']->get_suffix('dhcp')) {
// check if DHCP main settings and valid DHCP entry
if (!in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
if (!in_array_ignore_case('dhcpService', $this->attributes['objectClass']) && !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
return false;
}
//Main settings
@ -193,6 +180,22 @@ class ddns extends baseModule {
return true;
}
/**
* Returns a list of modifications which have to be made to the LDAP account.
*
* @return array list of modifications
* <br>This function returns an array with 3 entries:
* <br>array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... )
* <br>DN is the DN to change. It may be possible to change several DNs (e.g. create a new user and add him to some groups via attribute memberUid)
* <br>"add" are attributes which have to be added to LDAP entry
* <br>"remove" are attributes which have to be removed from LDAP entry
* <br>"modify" are attributes which have to been modified in LDAP entry
* <br>"info" are values with informational value (e.g. to be used later by pre/postModify actions)
*/
public function save_attributes() {
// done by dhcp_server object
}
/**
* This function check if ddns is enable.
*/
@ -249,7 +252,7 @@ class ddns extends baseModule {
* Process for mainsettings
*/
public function process_attributes_mainSettings() {
if (!in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
if (!in_array_ignore_case('dhcpService', $this->attributes['objectClass']) && !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
return array();
}
$errors = array();
@ -339,11 +342,13 @@ class ddns extends baseModule {
* @return htmlElement HTML meta data
*/
public function display_html_attributes() {
$this->attributes = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes;
$this->orig = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->orig;
$return = new htmlTable();
// check if DHCP main settings and valid DHCP entry
if ($_SESSION['config']->get_suffix('dhcp') == $this->getAccountContainer()->dn_orig) {
if (!in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
$return->addElement(new htmlStatusMessage('ERROR', _('Please set your LDAP suffix to an LDAP entry with object class "dhcpServer".')));
if (!in_array_ignore_case('dhcpService', $this->attributes['objectClass']) && !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
$return->addElement(new htmlStatusMessage('ERROR', _('Please set your LDAP suffix to an LDAP entry with object class "dhcpService" or "dhcpServer".')));
return $return;
}
}
@ -364,7 +369,6 @@ class ddns extends baseModule {
else {
// DNS server
$serverInput = new htmlTableExtendedInputField(_('IP address of the DNS server'), 'ip', $this->getDNSServer(), 'dns');
$serverInput->setRequired(true);
$return->addElement($serverInput, true);
$zones = $this->getZoneNames();
@ -378,11 +382,9 @@ class ddns extends baseModule {
}
// zone names
$zoneInput = new htmlTableExtendedInputField(_('Zone names'), 'zone', $zone, 'zone');
$zoneInput->setRequired(true);
$return->addElement($zoneInput, true);
// reverse zone names
$revZoneInput = new htmlTableExtendedInputField(_('Reverse zone names'), 'zone_reverse', $revzone, 'zone_reverse');
$revZoneInput->setRequired(true);
$return->addElement($revZoneInput);
}
}
@ -396,6 +398,9 @@ class ddns extends baseModule {
* @return array list of possible PDF entries
*/
public function get_pdfEntries() {
// attributes are taken from DHCP server object
$this->attributes = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->attributes;
$this->orig = &$this->getAccountContainer()->getAccountModule('dhcp_settings')->orig;
$zones = $this->getZoneNames();
$zone = '';
$revzone = '';

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 - 2012 Roland Gruber
2008 - 2013 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
@ -342,7 +342,7 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
public function process_attributes() {
// check if DHCP main settings and valid DHCP entry
if ($_SESSION['config']->get_suffix('dhcp') == $this->getAccountContainer()->dn_orig) {
if (!in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
if (!in_array_ignore_case('dhcpService', $this->attributes['objectClass']) && !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
return array();
}
}
@ -517,8 +517,8 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
$return = new htmlTable();
// check if DHCP main settings and valid DHCP entry
if ($_SESSION['config']->get_suffix('dhcp') == $this->getAccountContainer()->dn_orig) {
if (!in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
$return->addElement(new htmlStatusMessage('ERROR', _('Please set your LDAP suffix to an LDAP entry with object class "dhcpServer".')));
if (!in_array_ignore_case('dhcpService', $this->attributes['objectClass']) && !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
$return->addElement(new htmlStatusMessage('ERROR', _('Please set your LDAP suffix to an LDAP entry with object class "dhcpService" or "dhcpServer".')));
return $return;
}
}