Code

Updated height of filter editor
[gosa.git] / gosa-core / plugins / admin / departments / class_domain.inc
1 <?php
2 /*
3  * This code is part of GOsa (http://www.gosa-project.org)
4  * Copyright (C) 2003-2008 GONICUS GmbH
5  *
6  * ID: $$Id: class_departmentGeneric.inc 11085 2008-05-28 10:54:49Z hickert $$
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
23 class domain extends department
24 {
25         /* attribute list for save action */
26         var $attributes     = array( "dc", "ou", "description","gosaUnitTag", "manager");
27         var $objectclasses  = array("top", "domain", "gosaDepartment");
28         var $structuralOC   = array("domain");
29         var $type       = "domain";
30         var $dc         = "";
31         var $orgi_dc    = "";
32         var $namingAttr = "dc";
34   var $manager_enabled = FALSE;
35   var $manager_name ="";
36   var $manager ="";
39   function check()
40   {
41     $message = plugin::check();
43                 /* Check for presence of this department */
44                 $ldap= $this->config->get_ldap_link();
45     $ldap->ls ("(&(dc=".$this->dc.")(objectClass=domain))", $this->base, array('dn'));
46     if ($this->orig_dc == "new" && $ldap->count()){
47                         $message[]= msgPool::duplicated(_("Name"));
48                 } elseif ($this->orig_dn != $this->dn && $ldap->count()){
49                         $message[]= msgPool::duplicated(_("Name"));
50                 }
52                 /* All required fields are set? */
53                 if ($this->dc == ""){
54                         $message[]= msgPool::required(_("Name"));
55                 }elseif(tests::is_department_name_reserved($this->dc,$this->base)){
56       $message[]= msgPool::reserved(_("Name"));
57     }elseif(!preg_match ('/[a-z0-9 \.,\-_]/i', $this->dc)){
58                         $message[]= msgPool::invalid(_("Name"), $this->dc, "/[a-z0-9 \.,\-_]/");
59                 }
61     /* Check description */
62                 if ($this->description == ""){
63                         $message[]= msgPool::required(_("Description"));
64                 }
66     /* Check if we are allowed to create or move this object
67      */
68     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
69       $message[] = msgPool::permCreate();
70     }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
71       $message[] = msgPool::permMove();
72     }
74     return($message);
75   }
78   /* Return plugin informations for acl handling */ 
79   static function plInfo()
80   {
81     return (array("plShortName"   => _("Domain Component"),
82           "plDescription" => _("Domain Component"),
83           "plSelfModify"  => FALSE,
84           "plPriority"    => 4,
85           "plDepends"     => array(),
86           "plSection"     => array("administration"),
87           "plCategory"    => array("department"),
89           "plProvidedAcls" => array(
90             "dc"                => _("Name"),
91             "description"       => _("Description"),
92             "base"              => _("Base"),
93             "manager"                 => _("Manager"),
94             "gosaUnitTag"       => _("Administrative settings"))
95           ));
96   }
97 }
99 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
100 ?>