X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fplugins%2Fadmin%2Fdepartments%2Fclass_countryGeneric.inc;h=f69343431fbadd2cdf126c1eac7d33ca5385a000;hb=5ed8f7927f541c15ff142664a0b26d14cf8c06fa;hp=b38fa2871c5c789446a408951696bd9325a96d90;hpb=680135992da4063e04476aaff73c7a94df3fc0b0;p=gosa.git diff --git a/gosa-core/plugins/admin/departments/class_countryGeneric.inc b/gosa-core/plugins/admin/departments/class_countryGeneric.inc index b38fa2871..f69343431 100644 --- a/gosa-core/plugins/admin/departments/class_countryGeneric.inc +++ b/gosa-core/plugins/admin/departments/class_countryGeneric.inc @@ -23,17 +23,54 @@ class country extends department { /* attribute list for save action */ - var $attributes = array( "c", "ou", "description"); - var $objectclasses = array("top", "country", "gosaDepartment"); - var $type ="c"; + var $attributes = array( "c", "ou", "description","gosaUnitTag", "manager"); + var $objectclasses = array("top", "gosaDepartment"); + var $structuralOC = array("country"); + var $type ="country"; var $c =""; var $orgi_c =""; var $namingAttr = "c"; + var $manager_enabled = FALSE; + var $manager_name =""; + var $manager =""; + function check() { $message = plugin::check(); + + /* Check for presence of this department */ + $ldap= $this->config->get_ldap_link(); + $ldap->ls ("(&(c=".$this->c.")(objectClass=country))", $this->base, array('dn')); + if ($this->orig_c == "new" && $ldap->count()){ + $message[]= msgPool::duplicated(_("Name")); + } elseif ($this->orig_dn != $this->dn && $ldap->count()){ + $message[]= msgPool::duplicated(_("Name")); + } + + /* All required fields are set? */ + if ($this->c == ""){ + $message[]= msgPool::required(_("Name")); + }elseif(tests::is_department_name_reserved($this->c,$this->base)){ + $message[]= msgPool::reserved(_("Name")); + }elseif(preg_match ('/[#+:=>\\\\\/]/', $this->c)){ + $message[]= msgPool::invalid(_("Name"), $this->c, "/[^#+:=>\\\\\/]/"); + } + + /* Check description */ + if ($this->description == ""){ + $message[]= msgPool::required(_("Description")); + } + + /* Check if we are allowed to create or move this object + */ + if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){ + $message[] = msgPool::permCreate(); + }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){ + $message[] = msgPool::permMove(); + } + return($message); } @@ -41,22 +78,21 @@ class country extends department /* Return plugin informations for acl handling */ static function plInfo() { - return (array("plShortName" => _("Country"), + return (array( + "plShortName" => _("Country"), "plDescription" => _("Country"), "plSelfModify" => FALSE, "plPriority" => 2, "plDepends" => array(), - "plSection" => array("admin"), + "plSection" => array("administration"), "plCategory" => array("department"), "plProvidedAcls" => array( -# "searchGuide" => _("Search guide"), -# "seeAlso" => _("See also"), - "street" => _("Street"), - "base" => _("Base"), - "gosaUnitTag" => _("Administrative settings"), + "c" => _("Country name"), "description" => _("Description"), - "c" => _("Country name")), + "manager" => _("Manager"), + "base" => _("Base"), + "gosaUnitTag" => _("Administrative settings")) )); } }