Re: Mass import - Real fix, I think
[Michael Banck]
> I took your patch and created an NMU (debdiff attached) and built some
> packages for wheezy if somebody wants to test them (I don't have a
> wheezy GOsa setup):
>
> deb http://people.debian.org/~mbanck/wheezy-gosa/ ./
>
> Let me know whether they work and I'll upload the NMU to unstable and
> see about getting it included in stable (though it's too late for r1 I
> guess).
Great work, and I had a look at the package you created. As I said
earlier, I suspect the patch contain more than it should, and it have
some white space changes that are not needed. So I took your patch
and reduced it to the bare minimum. My new suggestion is attached,
but have not been tested yet. I did not change the template text to
mention that a password is needed, as I am unsure if that is only the
case for Debian Edu with our Kerberos backend.
Please go ahead with the NMU. :)
--
Happy hacking
Petter Reinholdtsen
Index: addons/ldapmanager/class_csvimport.inc
===================================================================
--- gosa/ldapmanager/addons/ldapmanager/class_csvimport.inc (revisjon 21231)
+++ gosa/ldapmanager/addons/ldapmanager/class_csvimport.inc (arbeidskopi)
@@ -175,17 +175,25 @@
/* Set all submitted vars */
- if(is_array($keys))
+ if(is_array($keys)){
foreach($keys as $key) {
if($key != "status"){
$this->usertab->$key = $dat[$key];
+ foreach($this->usertab->by_object as $pname => $plugin){
+ if(isset($this->usertab->by_object[$pname]->$key)){
+ $this->usertab->by_object[$pname]->$key = $dat[$key];
+ }
+ }
}
}
+ }
/* Initialize template */
if($this->csvinfo['tplid']!=0){
- $this->usertab->adapt_from_template($this->csvinfo['arrtempls'][$this->csvinfo['tplid']]['dn']);
- $this->usertab->save_object();
+ $tpl_dn = $this->csvinfo['arrtempls'][$this->csvinfo['tplid']]['dn'];
+ $this->usertab->adapt_from_template($tpl_dn,array("uid","cn","givenName","sn"));
+ $tpl_base = preg_replace("/^[^,]+,".preg_quote(get_people_ou(), '/i')."/", '', $tpl_dn);
+ $this->usertab->by_object['user']->base= $tpl_base;
} else {
/* Reset vars */
Index: addons/ldapmanager/contentcsv.tpl
===================================================================
--- gosa/ldapmanager/addons/ldapmanager/contentcsv.tpl (revisjon 21231)
+++ gosa/ldapmanager/addons/ldapmanager/contentcsv.tpl (arbeidskopi)
@@ -1,5 +1,3 @@
-<font color='red'>Temporary disabled</font>
-<!--
<p>
{t}The CSV import plug-in provides methods to generate user accounts from a file containing Comma Separated Values. The administrator can decide which columns should be transfered to which attribute. Note that you must have at least the UID, GIVENNAME and SURNAME set.{/t}
</p>
@@ -122,4 +120,3 @@
{/if}
</div>
<input type="hidden" name="ignore">
--->
Reply to: