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