[phpldapadmin] [ phpldapadmin-Bugs-3355722 ] Issue in MultiList attribute type
"SourceForge.net" <[email protected]> Thu, 07 Jul 2011 23:45:43 +1000
| Newsgroups | gmane.comp.ldap.davedap |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #3355722, was opened at 2011-07-06 17:24
Message generated for change (Comment added) made by wurley
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=498546&aid=3355722&group_id=61828
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: 1.2.x
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Felix Chelu (montombe)
Assigned to: Nobody/Anonymous (nobody)
Summary: Issue in MultiList attribute type
Initial Comment:
phpLDAPadmin version: 1.2.1.1
PHP version: 5.2.6 with Suhosin-Patch 0.9.6.2 (cli) (built: Feb 12 2010 15:26:33)
Apache version: Apache/2.2.10 (Linux/SUSE) built: May 5 2010 14:32:30
OS: Suse Linux Enterprise Server 11 SP 1
I'm encountering an issue when using the MultiList feature.
I've defined a template with following attribute: (objectClass = hostObject)
<attribute id="host">
<display>Allowed Hosts</display>
<type>multiselect</type>
<value><![CDATA[=php.MultiList(/;(&(objectClass=ipHost));cn;%cn%)]]></value>
</attribute>
Generally everything works fine.
But, when modifying this attribute by unselecting ALL items, the changes are not detected, so I can not save.
This happens because HTML in case of <input type="checkbox" ...> does not send the form value if unchecked.
So the lib/Template.php file which iterates through the new posted attribute values does not even check for modifications for this attribute.
Easy to reproduce:
+ Modify one of the existing templates to have a MultiList attribute with static key-value pairs, e.g.
<attribute id="authorizedService">
<display>Allowed Services</display>
<type>multiselect</type>
<value id="login">login</value>
<value id="openvpn">openvpn</value>
<value id="sshd">sshd</value>
<value id="sudo">sudo</value>
</attribute>
+ Than select a few or all of them and save.
+ Than unselect all of them and save.
-> Changes will not be detected.
Possible Solution:
I guess there are different ways to solve this and you might find a better one. I've solved it for now this way:
Edit lib/PageRender.php
Find the lines where the <input type="checkbox" ... > is rendered.
Above the two for loops add a further dummy (empty) formular element with the same name as the checkboxes have:
printf('<tr><td colspan="2"><input type="hidden" id="new_values_%s_%s" name="new_values[%s][]" value="%s"/></td></tr>',
htmlspecialchars($attribute->getName()),$j++,
htmlspecialchars($attribute->getName()),'');
That's it. This would guarantee that at least one correct key=value pair would be posted back, even if all checkboxes are unchecked.
Hope to helped with this post.
----------------------------------------------------------------------
>Comment By: Deon George (wurley)
Date: 2011-07-07 23:45
Message:
Thanks for the fix - it appears to work well.
Committed to git #caeba72
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=498546&aid=3355722&group_id=61828
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
______________________________________
phpLDAPadmin development mailing list.
To unsbuscribe: https://lists.sourceforge.net/lists/listinfo/phpldapadmin-devel
http://phpldapadmin.sourceforge.net/