X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=gosa-core%2Fplugins%2Fadmin%2Fdepartments%2Fclass_localityGeneric.inc;h=5394bcbd8e09e86f680f8a45f754715492d0cf76;hb=10100c5c8d92e45a0719bc321a3767f65966d9d7;hp=0f563976e7120e7f0cb64b8f32877066cb7523ff;hpb=680135992da4063e04476aaff73c7a94df3fc0b0;p=gosa.git diff --git a/gosa-core/plugins/admin/departments/class_localityGeneric.inc b/gosa-core/plugins/admin/departments/class_localityGeneric.inc index 0f563976e..5394bcbd8 100644 --- a/gosa-core/plugins/admin/departments/class_localityGeneric.inc +++ b/gosa-core/plugins/admin/departments/class_localityGeneric.inc @@ -23,11 +23,12 @@ class locality extends department { /* attribute list for save action */ - var $attributes = array("l", "description", "ou"); - var $objectclasses = array("top", "locality", "gosaDepartment"); + var $attributes = array("l", "description", "ou", "gosaUnitTag"); + var $objectclasses = array("top", "gosaDepartment"); + var $structuralOC = array("locality"); var $description= ""; - var $type = "l"; + var $type = "locality"; var $l = ""; var $orig_l = ""; var $namingAttr = "l"; @@ -35,6 +36,38 @@ class locality extends department function check() { $message = plugin::check(); + + /* Check for presence of this department */ + $ldap= $this->config->get_ldap_link(); + $ldap->ls ("(&(l=".$this->l.")(objectClass=locality))", $this->base, array('dn')); + if ($this->orig_l == "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->l == ""){ + $message[]= msgPool::required(_("Name")); + }elseif(tests::is_department_name_reserved($this->l,$this->base)){ + $message[]= msgPool::reserved(_("Name")); + }elseif(preg_match ('/[#+:=>\\\\\/]/', $this->l)){ + $message[]= msgPool::invalid(_("Name"), $this->l, "/[^#+:=>\\\\\/]/"); + } + + /* 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); } @@ -47,19 +80,14 @@ class locality extends department "plSelfModify" => FALSE, "plPriority" => 3, "plDepends" => array(), - "plSection" => array("admin"), + "plSection" => array("administration"), "plCategory" => array("department"), "plProvidedAcls" => array( - - - - "description" => _("Description"), "l" => _("Location"), - "st" => _("State"), - + "description" => _("Description"), "base" => _("Base"), - "gosaUnitTag" => _("Administrative settings")), + "gosaUnitTag" => _("Administrative settings")) )); } }