1 <?php
3 class goLdapServer extends goService{
5 var $cli_summary = "This plugin is used within the ServerService Pluign \nand indicates that this server has goLdapServer defined.";
6 var $cli_description = "Some longer text\nfor help";
7 var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
9 /* This plugin only writes its objectClass */
10 var $objectclasses = array("goLdapServer");
11 var $attributes = array("goLdapBase");
12 var $StatusFlag = "goLdapServerStatus";
14 /* This class can't be assigned twice so it conflicts with itsself */
15 var $conflicts = array("goLdapServer");
17 var $DisplayName = "";
18 var $dn = NULL;
19 var $cn = "";
20 var $goLdapServerStatus = "";
21 var $goLdapBase = "";
22 var $view_logged =FALSE;
24 function goLdapServer(&$config,$dn)
25 {
26 goService::goService($config,$dn);
27 $this->DisplayName = _("LDAP service");
28 }
31 function execute()
32 {
34 if($this->is_account && !$this->view_logged){
35 $this->view_logged = TRUE;
36 new log("view","server/".get_class($this),$this->dn);
37 }
39 $smarty = get_smarty();
40 foreach($this->attributes as $attr){
41 $smarty->assign($attr,$this->$attr);
42 }
43 $tmp = $this->plInfo();
44 foreach($tmp['plProvidedAcls'] as $name => $translated){
45 $smarty->assign($name."ACL",$this->getacl($name));
46 }
47 return($smarty->fetch(get_template_path("goLdapServer.tpl",TRUE,dirname(__FILE__))));
48 }
51 function getListEntry()
52 {
53 $fields = goService::getListEntry();
54 $fields['Message'] = _("LDAP service");
55 $fields['AllowEdit'] = true;
56 return($fields);
57 }
61 function check()
62 {
63 $message = plugin::check();
64 if(empty($this->goLdapBase)){
65 $message[] = msgPool::required(_("Base"));
66 }
67 if(!preg_match("/^ldap[si]?:\/\/[^\/]+\/.+$/", $this->goLdapBase)){
68 $message[] = msgPool::invalid(_("Base"),"","","ldap[si]://base");
69 }
70 return($message);
71 }
74 function save_object()
75 {
76 if(isset($_POST['goLdapServerPosted'])){
77 plugin::save_object();
78 }
79 }
82 /* Return plugin informations for acl handling */
83 static function plInfo()
84 {
85 return (array(
86 "plShortName" => _("Ldap"),
87 "plDescription" => _("Ldap")." ("._("Services").")",
88 "plSelfModify" => FALSE,
89 "plDepends" => array(),
90 "plPriority" => 96,
91 "plSection" => array("administration"),
92 "plCategory" => array("server"),
94 "plProvidedAcls"=> array(
95 "goLdapBase" => _("Ldap base"))
96 ));
97 }
98 }
99 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
100 ?>