Code

Added checks
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 1 Jun 2010 11:32:58 +0000 (11:32 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 1 Jun 2010 11:32:58 +0000 (11:32 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18812 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/dyngroup/addons/dyngroup/classDynamicLdapGroup.inc
gosa-plugins/dyngroup/addons/dyngroup/dyngroup.tpl

index 35a925ec6f11e7785d86a86c8c68cc76d3955539..b8bf59797567df14cb2a39df7f63cc2b968dba04 100644 (file)
@@ -95,7 +95,36 @@ class DynamicLdapGroup extends plugin
 
     public function check ()
     {
-        return Array();
+        $messages = plugin::check();
+        
+        // At least one entry is required. 
+        if(!count($this->labeledURIparsed)){
+            $messages[] = msgPool::required(_("Labeled Uri"));
+        }  
+
+        // Check entries
+        foreach($this->labeledURIparsed as $key => $entry){
+            $nr = $key +1;
+
+            // A base is required
+            if(empty($entry['base'])){
+                $messages[] = msgPool::required(_("Base")." {$nr}");
+            }
+
+            // Check for invalid attributes
+            if(empty($entry['attr'])){
+                $messages[] = msgPool::required(_("Attribute")." {$nr}");
+            }elseif(in_array(strtolower($entry['attr']), array('objectclass'))){
+                $messages[] = msgPool::reserved(_("Attribute")." {$nr}");
+            }
+
+            // A filter is required
+            if(empty($entry['filter'])){
+                $messages[] = msgPool::required(_("Filter")." {$nr}");
+            }
+        }
+        return($messages);
     }
 
 
index c50aa14df7472337d0565afa62a5a447f6eb5625..ad5dfc69a5cbb549a592363fca19977227fd4787 100644 (file)
 {foreach item=item key=key from=$labeledURIparsed}
  <tr>
   <td>
-    <input type='text' value='{$item.base}'>
+    <input type='text' value='{$item.base}' name='base_{$key}'>
   </td>
   <td>
-    <select name='scope' size='1'>
+    <select name='scope_{$key}' size='1'>
      {html_options options=$scopes selected=$item.scope}
     </select>
   </td>