[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Mass import - Real fix, I think



tags 698840 +patch
thanks

Hi,

On Thu, Jun 06, 2013 at 09:57:43PM +0200, Petter Reinholdtsen wrote:
> [Giorgio Pioda]
> > Hi,
> > 
> > comparing the squeeze and the wheezy versions of class_csvimport.inc
> > I've found some inconsistency of the latter version between line 177
> > and line 199 (missing brackets and maybe also some missing arguments
> > for a function).
> > 
> > I backported two little pieces of code from squeeze and the
> > mass import is now working on gosa 2.7 basis
> > 
> > Here the modified file:
> > 
> > http://dati.spse.ch/~gfwp/class_csvimport.inc
> 
> [Wolfgang Schweer]
> > Seems to work, too. No tweaking of contentcsv.tpl needed any more.
> 
> Very good.  This seem to be the change, as reported by using
> "svn diff -x --ignore-all-space" after checking out
> <URL: https://oss.gonicus.de/repositories/gosa/trunk/gosa-plugins/ldapmanager >
> using svn.
> 
> CC to the BTS report.

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).


Cheers,

Michael
diff -Nru gosa-2.7.4/debian/changelog gosa-2.7.4/debian/changelog
--- gosa-2.7.4/debian/changelog	2013-02-07 21:28:31.000000000 +0100
+++ gosa-2.7.4/debian/changelog	2013-06-08 19:01:01.000000000 +0200
@@ -1,3 +1,11 @@
+gosa (2.7.4-4.3) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * debian/patches/fix-mass-ldapimport.patch: New patch, fixes LDAP mass
+    import, by Giorgio Pioda and Petter Reinholdtsen. (Closes: #698840)
+
+ -- Michael Banck <mbanck@debian.org>  Sat, 08 Jun 2013 18:59:37 +0200
+
 gosa (2.7.4-4.2) unstable; urgency=low
 
   [ Jonathan Wiltshire ]
diff -Nru gosa-2.7.4/debian/patches/fix-mass-ldapimport.patch gosa-2.7.4/debian/patches/fix-mass-ldapimport.patch
--- gosa-2.7.4/debian/patches/fix-mass-ldapimport.patch	1970-01-01 01:00:00.000000000 +0100
+++ gosa-2.7.4/debian/patches/fix-mass-ldapimport.patch	2013-06-08 18:59:20.000000000 +0200
@@ -0,0 +1,76 @@
+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 */
+@@ -216,6 +224,7 @@
+               msg_dialog::displayChecks($this->usertab->check());
+               $this->csvinfo['sorteddata'][$i]['status']="<b>"._("failed")."</b>";
+               $failing = $i+1;
++              //echo "failing: $failing";
+               break;
+             } else {
+               $this->csvinfo['sorteddata'][$i]['status']=_("OK");
+Index: addons/ldapmanager/contentimport.tpl
+===================================================================
+--- gosa/ldapmanager/addons/ldapmanager/contentimport.tpl        (revisjon 21231)
++++ gosa/ldapmanager/addons/ldapmanager/contentimport.tpl        (arbeidskopi)
+@@ -1,10 +1,3 @@
+-<font color='red'>Temporary disabled</font>
+-<!--
+-
+-
+-
+-
+-
+ {if $type == FALSE || $LDIFError != FALSE}
+ <p style="margin-top:5px;">
+   {t}The LDIF import plug-in provides methods to upload a set of entries to your running LDAP directory as LDIF. You may use this to add new or modify existing entries. Remember that GOsa will not check your LDIF for GOsa conformance.{/t}
+@@ -62,4 +55,3 @@
+ </div>
+ 
+ <input type="hidden" name="ignore">
+--->
+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">
+--->
diff -Nru gosa-2.7.4/debian/patches/series gosa-2.7.4/debian/patches/series
--- gosa-2.7.4/debian/patches/series	2012-06-19 09:57:50.000000000 +0200
+++ gosa-2.7.4/debian/patches/series	2013-06-08 18:58:37.000000000 +0200
@@ -5,3 +5,4 @@
 03_fix_class_mapping.patch
 04_fix_locale_location.patch
 no-image-warning.patch
+fix-mass-ldapimport.patch

Reply to: