X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_goGlpiServer.inc;h=5851b8f015bcf69fd0c21892ed27f68769a28bf3;hb=99ee92a703ab07286a61eb0a094ef7e9b7f27730;hp=39fe8990c077fd7b5557e631e01482f9e96c20b2;hpb=1e93f456bafdd1bb637d688e97df17f9082a5b5a;p=gosa.git diff --git a/plugins/admin/systems/class_goGlpiServer.inc b/plugins/admin/systems/class_goGlpiServer.inc index 39fe8990c..5851b8f01 100644 --- a/plugins/admin/systems/class_goGlpiServer.inc +++ b/plugins/admin/systems/class_goGlpiServer.inc @@ -1,6 +1,8 @@ DisplayName = _("Glpi database"); + $this->DisplayName = _("Inventory database"); } @@ -36,7 +39,10 @@ class goGlpiServer extends plugin{ $smarty = get_smarty(); foreach($this->attributes as $attr){ $smarty->assign($attr,$this->$attr); - $smarty->assign($attr."ACL",chkacl($this->acl,$attr)); + } + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation ){ + $smarty->assign($name."ACL",$this->getacl($name)); } return($smarty->fetch(get_template_path("goGlpiServer.tpl",TRUE,dirname(__FILE__)))); } @@ -44,97 +50,20 @@ class goGlpiServer extends plugin{ function getListEntry() { - $flag = $this->StatusFlag; - $fields['Status'] = $this->$flag; - $fields['Message'] = _("Glpi management"); - $fields['AllowStart'] = true; - $fields['AllowStop'] = true; - $fields['AllowReset'] = true; - $fields['AllowRemove']= true; + $fields = goService::getListEntry(); + $fields['Message'] = _("Inventory database service"); $fields['AllowEdit'] = true; return($fields); } - - function remove_from_parent() - { - plugin::remove_from_parent(); - /* Check if this is a new entry ... add/modify */ - $ldap = $this->config->get_ldap_link(); - $ldap->cat($this->dn,array("objectClass")); - if($ldap->count()){ - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - }else{ - $ldap->cd($this->dn); - $ldap->add($this->attrs); - } - show_ldap_error($ldap->get_error()); - } - - - function save() - { - plugin::save(); - /* Check if this is a new entry ... add/modify */ - $ldap = $this->config->get_ldap_link(); - $ldap->cat($this->dn,array("objectClass")); - if($ldap->count()){ - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - }else{ - $ldap->cd($this->dn); - $ldap->add($this->attrs); - } - show_ldap_error($ldap->get_error()); - } - - - /* Directly save new status flag */ - function setStatus($value) - { - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $ldap->cat($this->dn,array("objectClass","goGlpiAdmin","goGlpiDatabase")); - - if($ldap->count()){ - $attrs =array(); - foreach(array("goGlpiAdmin","goGlpiDatabase") as $req) { - if(!isset($attrs[$req])){ - if(empty($this->$req)){ - print_red(sprintf(_("The required attribute '%s' is not set."),$req)); - }else{ - $attrs[$req] = $this->$req; - } - }else{ - $attrs[$req] = $attrs[$req][0]; - } - } - - $tmp = $ldap->fetch(); - for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ - $attrs['objectClass'][] = $tmp['objectClass'][$i]; - } - if(!in_array("goGlpiServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goGlpiServer"; - } - - $flag = $this->StatusFlag; - $attrs[$flag] = $value; - $this->$flag = $value; - $ldap->modify($attrs); - show_ldap_error($ldap->get_error()); - } - } - - function check() { $message = plugin::check(); - foreach(array("goGlpiAdmin","goGlpiDatabase") as $attr){ - if(empty($this->$attr)){ - $message[]= sprintf(_("The attribute '%s' is empty or contains invalid characters."), $attr); - } + if(empty($this->goGlpiAdmin)){ + $message[]= _("The attribute user is empty or contains invalid characters."); + } + if(empty($this->goGlpiDatabase)){ + $message[]= _("The attribute database is empty or contains invalid characters."); } return($message); } @@ -142,10 +71,35 @@ class goGlpiServer extends plugin{ function save_object() { - if(isset($_POST['goLogDBServerPosted'])){ + if(isset($_POST['goGlpiServer_posted'])){ plugin::save_object(); } - } + } + + /* Return plugin informations for acl handling */ + function plInfo() + { + return (array( + "plShortName" => _("Inventory database"), + "plDescription" => _("Inventory database")." ("._("Services").")" , + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 93, + "plSection" => array("administration"), + "plCategory" => array("server"), + + "plProvidedAcls"=> array( + "start" => _("Start"), + "stop" => _("Stop"), + "restart" => _("Restart"), + + "goGlpiAdmin" => _("Admin"), + "goGlpiDatabase" => _("Database"), + "goGlpiPassword" => _("Password")) + )); + } + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>