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 var $krb_service_prefix = "ldap/";
26 function goLdapServer(&$config,$dn)
27 {
28 goService::goService($config,$dn);
29 $this->DisplayName = _("LDAP service");
30 }
33 function execute()
34 {
36 if($this->is_account && !$this->view_logged){
37 $this->view_logged = TRUE;
38 new log("view","server/".get_class($this),$this->dn);
39 }
41 $smarty = get_smarty();
42 foreach($this->attributes as $attr){
43 $smarty->assign($attr,$this->$attr);
44 }
45 $tmp = $this->plInfo();
46 foreach($tmp['plProvidedAcls'] as $name => $translated){
47 $smarty->assign($name."ACL",$this->getacl($name));
48 }
49 return($smarty->fetch(get_template_path("goLdapServer.tpl",TRUE,dirname(__FILE__))));
50 }
53 function getListEntry()
54 {
55 $fields = goService::getListEntry();
56 $fields['Message'] = _("LDAP service");
57 $fields['AllowEdit'] = true;
58 return($fields);
59 }
63 function check()
64 {
65 $message = plugin::check();
66 if(empty($this->goLdapBase)){
67 $message[] = msgPool::required(_("Base"));
68 }
69 if(!preg_match("/^ldap[si]?:\/\/[^\/]+\/.+$/", $this->goLdapBase)){
70 $message[] = msgPool::invalid(_("Base"),"","","ldap[si]://base");
71 }
72 return($message);
73 }
76 function save_object()
77 {
78 if(isset($_POST['goLdapServerPosted'])){
79 plugin::save_object();
80 }
81 }
84 /* Return plugin informations for acl handling */
85 static function plInfo()
86 {
87 return (array(
88 "plShortName" => _("Ldap"),
89 "plDescription" => _("Ldap")." ("._("Services").")",
90 "plSelfModify" => FALSE,
91 "plDepends" => array(),
92 "plPriority" => 96,
93 "plSection" => array("administration"),
94 "plCategory" => array("server"),
96 "plProvidedAcls"=> array(
97 "goLdapBase" => _("Ldap base"))
98 ));
99 }
100 }
101 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
102 ?>