Commit 352a7b77 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(opsi): Fix case of fdOpsiServerDn attribute

This fixes problems with the OPSI plugin related to the case of the LDAP
 attribute fdOpsiServerDn

closes #5708
Showing with 22 additions and 22 deletions
+22 -22
...@@ -48,7 +48,7 @@ class opsiOnDemandList extends opsiSoftwareList ...@@ -48,7 +48,7 @@ class opsiOnDemandList extends opsiSoftwareList
'attrs' => array( 'attrs' => array(
new SubmittingOPSIServerAttribute( new SubmittingOPSIServerAttribute(
_('OPSI server'), _('OPSI server to use for deployment'), _('OPSI server'), _('OPSI server to use for deployment'),
'fdOpsiServerDN', TRUE 'fdOpsiServerDn', TRUE
), ),
new HostNameAttribute( new HostNameAttribute(
_('Name'), _('Name of this OPSI profile'), _('Name'), _('Name of this OPSI profile'),
......
...@@ -87,7 +87,7 @@ class opsiProfile extends simplePlugin ...@@ -87,7 +87,7 @@ class opsiProfile extends simplePlugin
'attrs' => array( 'attrs' => array(
new SubmittingOPSIServerAttribute( new SubmittingOPSIServerAttribute(
_('OPSI server'), _('OPSI server to use for deployment'), _('OPSI server'), _('OPSI server to use for deployment'),
'fdOpsiServerDN', TRUE 'fdOpsiServerDn', TRUE
), ),
new HostNameAttribute( new HostNameAttribute(
_('Name'), _('Name of this OPSI profile'), _('Name'), _('Name of this OPSI profile'),
...@@ -136,7 +136,7 @@ class opsiProfile extends simplePlugin ...@@ -136,7 +136,7 @@ class opsiProfile extends simplePlugin
} }
} else { } else {
msg_dialog::display( msg_dialog::display(
sprintf(_("Could not find %s in the LDAP"), $this->fdOpsiServerDN), sprintf(_("Could not find %s in the LDAP"), $this->fdOpsiServerDn),
msgPool::ldaperror($ldap->get_error()), ERROR_DIALOG msgPool::ldaperror($ldap->get_error()), ERROR_DIALOG
); );
return FALSE; return FALSE;
...@@ -148,7 +148,7 @@ class opsiProfile extends simplePlugin ...@@ -148,7 +148,7 @@ class opsiProfile extends simplePlugin
public function server_changed () public function server_changed ()
{ {
global $config; global $config;
if (!isset($this->products[$this->fdOpsiServerDN])) { if (!isset($this->products[$this->fdOpsiServerDn])) {
$s_daemon = new supportDaemon(); $s_daemon = new supportDaemon();
if (!$s_daemon->is_available()) { if (!$s_daemon->is_available()) {
msg_dialog::display( msg_dialog::display(
...@@ -158,20 +158,20 @@ class opsiProfile extends simplePlugin ...@@ -158,20 +158,20 @@ class opsiProfile extends simplePlugin
return; return;
} }
$ldap = $config->get_ldap_link(); $ldap = $config->get_ldap_link();
$ldap->cat($this->fdOpsiServerDN); $ldap->cat($this->fdOpsiServerDn);
if ($attrs = $ldap->fetch()) { if ($attrs = $ldap->fetch()) {
if (isset($attrs['macAddress'])) { if (isset($attrs['macAddress'])) {
$this->macAddress = $attrs['macAddress'][0]; $this->macAddress = $attrs['macAddress'][0];
} else { } else {
msg_dialog::display( msg_dialog::display(
_("No mac address"), _("No mac address"),
sprintf(_("Server %s has no mac address configured in the LDAP"), $this->fdOpsiServerDN), ERROR_DIALOG sprintf(_("Server %s has no mac address configured in the LDAP"), $this->fdOpsiServerDn), ERROR_DIALOG
); );
return FALSE; return FALSE;
} }
} else { } else {
msg_dialog::display( msg_dialog::display(
sprintf_(_("Could not find %s in the LDAP"), $this->fdOpsiServerDN), sprintf_(_("Could not find %s in the LDAP"), $this->fdOpsiServerDn),
msgPool::ldaperror($ldap->get_error()), ERROR_DIALOG msgPool::ldaperror($ldap->get_error()), ERROR_DIALOG
); );
return FALSE; return FALSE;
...@@ -184,27 +184,27 @@ class opsiProfile extends simplePlugin ...@@ -184,27 +184,27 @@ class opsiProfile extends simplePlugin
); );
return; return;
} }
$this->products[$this->fdOpsiServerDN]['netboots'] = $netboots; $this->products[$this->fdOpsiServerDn]['netboots'] = $netboots;
$ldap->cd($config->current['BASE']); $ldap->cd($config->current['BASE']);
//~ $ldap->search('(&(|(objectClass=opsiOnDemandList)(objectClass=opsiSoftwareList))(fdOpsiServerDN='.$this->fdOpsiServerDN.'))', array('cn')); //~ $ldap->search('(&(|(objectClass=opsiOnDemandList)(objectClass=opsiSoftwareList))(fdOpsiServerDN='.$this->fdOpsiServerDN.'))', array('cn'));
$ldap->search('(&(objectClass=opsiSoftwareList)(fdOpsiServerDN='.$this->fdOpsiServerDN.'))', array('cn')); $ldap->search('(&(objectClass=opsiSoftwareList)(fdOpsiServerDn='.$this->fdOpsiServerDn.'))', array('cn'));
$lists = array(); $lists = array();
while ($attrs = $ldap->fetch()) { while ($attrs = $ldap->fetch()) {
$lists[$attrs['dn']] = $attrs['cn'][0]; $lists[$attrs['dn']] = $attrs['cn'][0];
} }
$this->products[$this->fdOpsiServerDN]['lists'] = $lists; $this->products[$this->fdOpsiServerDn]['lists'] = $lists;
} }
$choices_values = array(); $choices_values = array();
$choices_labels = array(); $choices_labels = array();
foreach ($this->products[$this->fdOpsiServerDN]['netboots'] as $netboot) { foreach ($this->products[$this->fdOpsiServerDn]['netboots'] as $netboot) {
$choices_values[] = $netboot['id']; $choices_values[] = $netboot['id'];
$choices_labels[] = sprintf(_('%s (%s)'), $netboot['id'], $netboot['name']); $choices_labels[] = sprintf(_('%s (%s)'), $netboot['id'], $netboot['name']);
} }
$this->attributesAccess['fdOpsiNetbootProduct']->setChoices($choices_values, $choices_labels); $this->attributesAccess['fdOpsiNetbootProduct']->setChoices($choices_values, $choices_labels);
$this->attributesAccess['fdOpsiSoftwareList']->attribute->setChoices( $this->attributesAccess['fdOpsiSoftwareList']->attribute->setChoices(
array_keys($this->products[$this->fdOpsiServerDN]['lists']), array_keys($this->products[$this->fdOpsiServerDn]['lists']),
array_values($this->products[$this->fdOpsiServerDN]['lists']) array_values($this->products[$this->fdOpsiServerDn]['lists'])
); );
} }
} }
......
...@@ -52,7 +52,7 @@ class opsiSoftwareList extends simplePlugin ...@@ -52,7 +52,7 @@ class opsiSoftwareList extends simplePlugin
'attrs' => array( 'attrs' => array(
new SubmittingOPSIServerAttribute( new SubmittingOPSIServerAttribute(
_('OPSI server'), _('OPSI server to use for deployment'), _('OPSI server'), _('OPSI server to use for deployment'),
'fdOpsiServerDN', TRUE 'fdOpsiServerDn', TRUE
), ),
new HostNameAttribute( new HostNameAttribute(
_('Name'), _('Name of this OPSI profile'), _('Name'), _('Name of this OPSI profile'),
...@@ -103,7 +103,7 @@ class opsiSoftwareList extends simplePlugin ...@@ -103,7 +103,7 @@ class opsiSoftwareList extends simplePlugin
if ($opsi_args == NULL) { if ($opsi_args == NULL) {
$opsi_args = array('id','name','setupScript','alwaysScript','onceScript','customScript','userLoginScript','updateScript','productVersion','packageVersion'); $opsi_args = array('id','name','setupScript','alwaysScript','onceScript','customScript','userLoginScript','updateScript','productVersion','packageVersion');
} }
if (!isset($this->products[$this->fdOpsiServerDN])) { if (!isset($this->products[$this->fdOpsiServerDn])) {
$s_daemon = new supportDaemon(); $s_daemon = new supportDaemon();
if (!$s_daemon->is_available()) { if (!$s_daemon->is_available()) {
msg_dialog::display( msg_dialog::display(
...@@ -113,20 +113,20 @@ class opsiSoftwareList extends simplePlugin ...@@ -113,20 +113,20 @@ class opsiSoftwareList extends simplePlugin
return; return;
} }
$ldap = $config->get_ldap_link(); $ldap = $config->get_ldap_link();
$ldap->cat($this->fdOpsiServerDN); $ldap->cat($this->fdOpsiServerDn);
if ($attrs = $ldap->fetch()) { if ($attrs = $ldap->fetch()) {
if (isset($attrs['macAddress'])) { if (isset($attrs['macAddress'])) {
$this->macAddress = $attrs['macAddress'][0]; $this->macAddress = $attrs['macAddress'][0];
} else { } else {
msg_dialog::display( msg_dialog::display(
_("No mac address"), _("No mac address"),
sprintf(_("Server %s has no mac address configured in the LDAP"), $this->fdOpsiServerDN), ERROR_DIALOG sprintf(_("Server %s has no mac address configured in the LDAP"), $this->fdOpsiServerDn), ERROR_DIALOG
); );
return FALSE; return FALSE;
} }
} else { } else {
msg_dialog::display( msg_dialog::display(
sprintf(_("Could not find %s in the LDAP"), $this->fdOpsiServerDN), sprintf(_("Could not find %s in the LDAP"), $this->fdOpsiServerDn),
msgPool::ldaperror($ldap->get_error()), ERROR_DIALOG msgPool::ldaperror($ldap->get_error()), ERROR_DIALOG
); );
return FALSE; return FALSE;
...@@ -139,13 +139,13 @@ class opsiSoftwareList extends simplePlugin ...@@ -139,13 +139,13 @@ class opsiSoftwareList extends simplePlugin
); );
return; return;
} }
$this->products[$this->fdOpsiServerDN]['localboots'] = array(); $this->products[$this->fdOpsiServerDn]['localboots'] = array();
foreach ($localboots as $localboot) { foreach ($localboots as $localboot) {
$this->products[$this->fdOpsiServerDN]['localboots'][$localboot['id']] = $localboot; $this->products[$this->fdOpsiServerDn]['localboots'][$localboot['id']] = $localboot;
} }
} }
$choices = array(); $choices = array();
foreach ($this->products[$this->fdOpsiServerDN]['localboots'] as $id => $infos) { foreach ($this->products[$this->fdOpsiServerDn]['localboots'] as $id => $infos) {
$choices[$id] = sprintf(_('%s (%s-%s)'), $infos['id'], $infos['productVersion'], $infos['packageVersion']); $choices[$id] = sprintf(_('%s (%s-%s)'), $infos['id'], $infos['productVersion'], $infos['packageVersion']);
} }
$this->attributesAccess['fdOpsiLocalbootProduct']->attribute->attributes[0]->setChoices( $this->attributesAccess['fdOpsiLocalbootProduct']->attribute->attributes[0]->setChoices(
...@@ -160,7 +160,7 @@ class opsiSoftwareList extends simplePlugin ...@@ -160,7 +160,7 @@ class opsiSoftwareList extends simplePlugin
$actions = array(); $actions = array();
foreach (array('setup', 'always', 'once', 'custom', 'userLogin', 'update') as $action) { foreach (array('setup', 'always', 'once', 'custom', 'userLogin', 'update') as $action) {
if (!empty($this->products[$this->fdOpsiServerDN]['localboots'][$localboot][$action.'Script'])) { if (!empty($this->products[$this->fdOpsiServerDn]['localboots'][$localboot][$action.'Script'])) {
$actions[] = strtolower($action); $actions[] = strtolower($action);
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment