32e2ad7619d1906ba6df79900772b1a14d3b21a0
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 country extends department
24 {
25 /* attribute list for save action */
26 var $attributes = array( "c", "ou", "description");
27 var $objectclasses = array("top", "country", "gosaDepartment");
28 var $type ="c";
29 var $c ="";
30 var $orgi_c ="";
32 var $namingAttr = "c";
34 function check()
35 {
36 $message = plugin::check();
38 /* Check for presence of this department */
39 $ldap= $this->config->get_ldap_link();
40 $ldap->ls ("(&(c=".$this->c.")(objectClass=country))", $this->base, array('dn'));
41 if ($this->orig_c == "new" && $ldap->count()){
42 $message[]= msgPool::duplicated(_("Name"));
43 } elseif ($this->orig_dn != $this->dn && $ldap->count()){
44 $message[]= msgPool::duplicated(_("Name"));
45 }
47 /* All required fields are set? */
48 if ($this->c == ""){
49 $message[]= msgPool::required(_("Name"));
50 }elseif(tests::is_department_name_reserved($this->c,$this->base)){
51 $message[]= msgPool::reserved(_("Name"));
52 }elseif(preg_match ('/[#+:=>\\\\\/]/', $this->c)){
53 $message[]= msgPool::invalid(_("Name"), $this->c, "/[^#+:=>\\\\\/]/");
54 }
56 /* Check description */
57 if ($this->description == ""){
58 $message[]= msgPool::required(_("Description"));
59 }
61 /* Check if we are allowed to create or move this object
62 */
63 if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){
64 $message[] = msgPool::permCreate();
65 }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){
66 $message[] = msgPool::permMove();
67 }
69 return($message);
70 }
73 /* Return plugin informations for acl handling */
74 static function plInfo()
75 {
76 return (array(
77 "plShortName" => _("Country"),
78 "plDescription" => _("Country"),
79 "plSelfModify" => FALSE,
80 "plPriority" => 2,
81 "plDepends" => array(),
82 "plSection" => array("admin"),
83 "plCategory" => array("department"),
85 "plProvidedAcls" => array(
86 "c" => _("Country name"),
87 "description" => _("Description"),
88 "base" => _("Base"),
89 "gosaUnitTag" => _("Administrative settings"))
90 ));
91 }
92 }
94 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
95 ?>