Code

Added check departments, to avoid creating system reseverd departments
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 5 May 2006 04:58:10 +0000 (04:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 5 May 2006 04:58:10 +0000 (04:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3203 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/departments/class_departmentGeneric.inc

index b9e54e3ca91d5b985bc3614a26b22f8f8f8e4695..6d0343adee3c9f16bab1eb62c7ded13d378cdd8d 100644 (file)
@@ -224,10 +224,17 @@ class department extends plugin
                }
 
                /* Validate and modify - or: spaghetti rules! */
-               if ($this->ou == "incoming"){
-                       $message[]= _("The field 'Name' contains the reserved word 'incoming'.".
-                                       " Please choose another name.");
+               $SkipNames = array(     "incoming","apps","systems","fai","config",     
+                                                       preg_replace("/ou=(.*),/","\\1",get_people_ou()),
+                                                       preg_replace("/ou=(.*),/","\\1",get_groups_ou())
+                                                       );      
+               foreach($SkipNames as $name){
+                       if ($this->ou == $name){
+                               $message[]= sprintf(_("The field 'Name' contains the reserved word '%s'. Please choose another name."),$name);
+                       }
                }
+
+
                if (preg_match ('/[#+:=>\\\\\/]/', $this->ou)){
                        $message[]= _("The field 'Name' contains invalid characters.");
                }