Code

Created trunk inside of 2.6-lhm
[gosa.git] / trunk / gosa-core / plugins / admin / departments / class_organizationGeneric.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 organization extends department
24 {
25         /* attribute list for save action */
26   var $attributes     = array( "o", "ou", "description","userPassword","searchGuide",
27       "seeAlso","businessCategory","x121Address","registeredAddress",
28       "destinationIndicator","preferredDeliveryMethod","telexNumber",
29       "telephoneNumber","internationaliSDNNumber","facsimileTelephoneNumber","street",
30       "postOfficeBox","postalCode", "postalAddress","physicalDeliveryOfficeName",
31       "st","l","teletexTerminalIdentifier","gosaUnitTag");
33   var $objectclasses  = array("top", "gosaDepartment");
34   var $structuralOC   = array("organization");
36   /* Attributes 
37    */ 
38   var $st                       ="";
39   var $l                        ="";
40   var $description              ="";
41   var $userPassword             ="";
42   var $searchGuide              ="";
43   var $seeAlso                  ="";
44   var $businessCategory         ="";
45   var $x121Address              ="";
46   var $registeredAddress        ="";
47   var $destinationIndicator     ="";
48   var $preferredDeliveryMethod  ="";
49   var $telexNumber              ="";
50   var $telephoneNumber          ="";
51   var $internationaliSDNNumber  ="";
52   var $facsimileTelephoneNumber ="";
53   var $street                   ="";
54   var $postOfficeBox            ="";
55   var $postalCode               ="";
56   var $postalAddress            ="";
57   var $teletexTerminalIdentifier="";
58   var $physicalDeliveryOfficeName="";
60   /* Naming attributes 
61    */
62   var $o            ="";
63   var $type         = "o";
64   var $orgi_o       = "";
65   var $namingAttr   = "o";
67   function check()
68   {
69     $message = plugin::check();
71                 /* Check for presence of this department */
72                 $ldap= $this->config->get_ldap_link();
73     $ldap->ls ("(&(o=".$this->o.")(objectClass=organization))", $this->base, array('dn'));
74     if ($this->orig_o == "new" && $ldap->count()){
75                         $message[]= msgPool::duplicated(_("Name"));
76                 } elseif ($this->orig_dn != $this->dn && $ldap->count()){
77                         $message[]= msgPool::duplicated(_("Name"));
78                 }
80                 /* All required fields are set? */
81                 if ($this->o == ""){
82                         $message[]= msgPool::required(_("Name"));
83                 }elseif(tests::is_department_name_reserved($this->o,$this->base)){
84       $message[]= msgPool::reserved(_("Name"));
85     }elseif(preg_match ('/[#+:=>\\\\\/]/', $this->o)){
86                         $message[]= msgPool::invalid(_("Name"), $this->o, "/[^#+:=>\\\\\/]/");
87                 }
89     /* Check description */
90                 if ($this->description == ""){
91                         $message[]= msgPool::required(_("Description"));
92                 }
94     /* Check if we are allowed to create or move this object
95      */
96     if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
97       $message[] = msgPool::permCreate();
98     }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
99       $message[] = msgPool::permMove();
100     }
102     return($message);
103   }
106   /* Return plugin informations for acl handling */
107   static function plInfo()
108   {
109     return (array("plShortName"   => _("Organization"),
110           "plDescription" => _("Organization"),
111           "plSelfModify"  => FALSE,
112           "plPriority"    => 1,
113           "plDepends"     => array(),
114           "plSection"     => array("administration"),
115           "plCategory"    => array("department"),
117           "plProvidedAcls" => array(
118             "o"                       => _("Organization name"),
119             "description"             => _("Description"),
120             "businessCategory"        => _("Category"),
121             "base"                    => _("Base"),
123             "st"                      => _("State"),
124             "l"                       => _("Location"),
125             "postalAddress"           => _("Postal address"),
126             "telephoneNumber"         => _("Phone number"),
127             "facsimileTelephoneNumber"=> _("Fax"),
129             "gosaUnitTag"             => _("Administrative settings"))
130           ));
131   }
135 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
136 ?>