12396: Tinebase - GroupSync: hidden groups, group description length
authorPaul Mehrer <p.mehrer@metaways.de>
Mon, 5 Dec 2016 10:56:41 +0000 (11:56 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 8 Dec 2016 12:40:37 +0000 (13:40 +0100)
* allow groups in syncbackend to which tine has no read access
* change group description length from varchar(255) to text

Change-Id: I26c0838d7fee783ecd414f35ee197bbb78e931ce
Reviewed-on: http://gerrit.tine20.com/customers/3914
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Expressomail/Setup/setup.xml
tine20/Sales/Setup/setup.xml
tine20/Setup/Backend/Mysql.php
tine20/Setup/Backend/Pgsql.php
tine20/Tinebase/Group.php
tine20/Tinebase/Setup/Update/Release9.php
tine20/Tinebase/Setup/setup.xml

index bc76f92..332c03f 100644 (file)
                 <field>
                     <name>name</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>host</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>credentials_id</name>
                 <field>
                     <name>email</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>from</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>organization</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>port</name>
                 <field>
                     <name>sent_folder</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>trash_folder</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>drafts_folder</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>templates_folder</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>has_children_support</name>
                 <field>
                     <name>ns_personal</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>ns_other</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>ns_shared</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>signature</name>
                 <field>
                     <name>smtp_hostname</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>smtp_port</name>
                 <field>
                     <name>sieve_hostname</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>sieve_port</name>
                 <field>
                     <name>action_type</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>action_argument</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>conditions</name>
                 <field>
                     <name>subject</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>from</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>mime</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                 </field>
                 <field>
                     <name>days</name>
index a71550f..3231a5b 100644 (file)
                 <field>
                     <name>description</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>true</notnull>
                 </field>
                 <field>
                 <field>
                     <name>model</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>true</notnull>
                 </field>
                 <field>
                     <name>title</name>
                     <type>text</type>
-                    <length>256</length>
+                    <length>255</length>
                     <notnull>true</notnull>
                 </field>
                 <field>
index 929b858..6ffe165 100644 (file)
@@ -36,7 +36,7 @@ class Setup_Backend_Mysql extends Setup_Backend_Abstract
             'defaultLength' => 1),
         'text' => array(
             'lengthTypes' => array(
-                256 => 'varchar', //@todo this should be 255 indeed but we have 256 in our setup.xml files
+                255 => 'varchar',
                 65535 => 'text',
                 16777215 => 'mediumtext',
                 4294967295 => 'longtext'),
index 777f41c..3ef3615 100644 (file)
@@ -35,7 +35,7 @@ class Setup_Backend_Pgsql extends Setup_Backend_Abstract
             'defaultLength' => 1),
         'text' => array(
             'lengthTypes' => array(
-                256 => 'character varying', //@todo this should be 255 indeed but we have 256 in our setup.xml files
+                255 => 'character varying',
                 65535 => 'character varying',
                 16777215 => 'character varying',
                 4294967295 => 'character varying'),
index e1ae677..3217c44 100644 (file)
@@ -170,7 +170,13 @@ class Tinebase_Group
             try {
                 $groupBackend->getGroupById($groupId);
             } catch (Tinebase_Exception_Record_NotDefined $tern) {
-                $group = $groupBackend->getGroupByIdFromSyncBackend($groupId);
+                try {
+                    $group = $groupBackend->getGroupByIdFromSyncBackend($groupId);
+                    // TODO use exact exception class Ldap something?
+                } catch (Exception $e) {
+                    // we dont get the group? ok, just ignore it, maybe we don't have rights to view it.
+                    continue;
+                }
                 Tinebase_Timemachine_ModificationLog::setRecordMetaData($group, 'create');
                 $groupBackend->addGroupInSqlBackend($group);
             }
index 0a0a1d7..2a4d5a4 100644 (file)
@@ -59,7 +59,7 @@ class Tinebase_Setup_Update_Release9 extends Setup_Update_Abstract
     }
 
     /**
-     * update to 9.9
+     * update to 9.5
      *
      * @see 0012300: add container owner column
      */
@@ -127,4 +127,26 @@ class Tinebase_Setup_Update_Release9 extends Setup_Update_Abstract
         if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
             . ' Set owner for ' . $count . ' containers.');
     }
+
+    /**
+     * update to 9.6
+     *
+     * change length of groups.description column from varchar(255) to text
+     */
+    public function update_5()
+    {
+        if ($this->getTableVersion('groups') < 6) {
+            $declaration = new Setup_Backend_Schema_Field_Xml(
+                '<field>
+                    <name>description</name>
+                    <type>text</type>
+                    <notnull>false</notnull>
+                </field>
+            ');
+            $this->_backend->alterCol('groups', $declaration);
+            $this->setTableVersion('groups', '6');
+        }
+
+        $this->setApplicationVersion('Tinebase', '9.6');
+    }
 }
index a38e3be..5136bd9 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <application>
     <name>Tinebase</name>
-    <version>9.5</version>
+    <version>9.6</version>
     <tables>
         <table>
             <name>applications</name>
 
         <table>
             <name>groups</name>
-            <version>5</version>
+            <version>6</version>
             <declaration>
                 <field>
                     <name>id</name>
                 <field>
                     <name>description</name>
                     <type>text</type>
-                    <length>255</length>
                     <notnull>false</notnull>
                 </field>
                 <field>