summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e280424)
raw | patch | inline | side by side (parent: e280424)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Jan 2010 07:56:43 +0000 (07:56 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Jan 2010 07:56:43 +0000 (07:56 +0000) |
-Added a lot of debugging ...
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15146 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15146 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/systems/admin/systems/class_systemManagement.inc | patch | blob | history |
diff --git a/gosa-plugins/systems/admin/systems/class_systemManagement.inc b/gosa-plugins/systems/admin/systems/class_systemManagement.inc
index 3558878d19bef7843804e0e8125ce0e8d9f8f586..3eae80e02678d9c7552ff6a2ca8793ed24770e31 100644 (file)
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+
+#
+# NewDevices
+# -> Edit
+# -> |- SelectDeviceType() (Allows to select target SystemType and OGroup)
+# -> Save
+# |-> systemTypeChosen() (Queue entry to be activated)
+# |-> handleActivationQueue() (Now acticvate objects)
+# |-> Ogroup selected
+# | |-> Try to adapt values from Ogroup and save directly.
+# |
+# |-> NO Ogroup selected
+# | |-> Open dialogs of the target object and allow modifcation.
+# |
+# |->activate_new_device() (Now activate the device)
+#
+#
+#
+#
+#
+#
+#
+
+
+
+
+
+
+
+
+
class systemManagement extends management
{
var $plHeadline = "Systems";
if(!class_available("ArpNewDeviceTabs")){
msg_dialog::display(_("Error"), msgPool::class_not_found("ArpNewDevice"), ERROR_DIALOG);
}else{
- $this->system_activation_object= array($dn);
return(management::editEntry($action,$target,$all,"ArpNewDeviceTabs","ARPNEWDEVICETABS","incoming"));
}
}elseif($type == "FAKE_OC_NewDevice"){
if(!class_available("SelectDeviceType")){
msg_dialog::display(_("Error"), msgPool::class_not_found("SelectDeviceType"), ERROR_DIALOG);
}else{
- $this->system_activation_object= array($dn);
+ $this->activationQueue[$dn] = array();
$this->dialogObject = new SelectDeviceType($this->config,$dn);
$this->skipFooter = TRUE;
$this->displayApplyBtn = FALSE;
function handleActivationQueue()
{
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ 'Entries left: '.count($this->activationQueue), "<b>Handling system activation queue!</b>");
+
if(!count($this->activationQueue)) return("");
$ldap = $this->config->get_ldap_link();
reset($this->activationQueue);
$dn = key($this->activationQueue);
$data= $this->activationQueue[$dn];
- unset($this->activationQueue[$dn]);
// Validate the given system type.
if(!isset($data['SS'])) continue;
}
$type = $pInfo[$sysType];
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ $dn, "<b>Try to activate:</b>");
+
// Get target type definition
$plugClass = $type["plugClass"];
$tabClass = $type["tabClass"];
if(!class_available($tabClass)){
msg_dialog::display(_("Error"), msgPool::class_not_found($tabclass), ERROR_DIALOG);
+ unset($this->activationQueue[$dn]);
+ continue;
}else{
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ $sysType, "<b>System type:</b>");
+
// Load permissions for selected 'dn' and check if we're allowed to create this 'dn'
$this->dn = $dn;
$acls = $ui->get_permissions($this->dn,$aclCategory."/".$plugClass);
if(!preg_match("/c/",$acls)){
unset($this->activationQueue[$dn]);
msg_dialog::display(_("Error"), msgPool::permCreate(), ERROR_DIALOG);
+
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ $acls, "<b>Insufficient permissions!</b>");
continue;
}else{
management::editEntry('editEntry',array($dn),array(),$tabClass,$tabDesc, $aclCategory);
$this->displayApplyBtn = FALSE;
$this->tabObject->set_acl_base($headpage->getBase());
+
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ $data['OG'], "<b>Selected ogroup:</b>");
+
if($data['OG'] != "none"){
$this->tabObject->base = preg_replace("/^[^,]+,".preg_quote(get_ou('ogroupRDN'), '/')."/i", "", $data['OG']);
$this->tabObject->by_object[$plugClass]->base = $this->tabObject->base;
$this->tabObject->by_object['opsiGeneric']->$attr = $source_attrs[$src][0];
}
}
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ "", "<b>OPSI attributes adapted</b>");
}
// Queue entry to be activated, when it is saved.
if(isset($this->tabObject->by_object[$tab]->gotoMode)) {
$found = true;
$this->tabObject->by_object[$tab]->gotoMode = $value;
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ $tab."->gotoMode = {$value}", "<b>Setting gotoMode to: </b>");
}
}
if(!$found){
if($og){
$og->AddDelMembership($this->tabObject->dn);
$og->save();
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ $og->dn, "<b>Adding system to ogroup</b>");
}
// Set default system specific attributes
foreach (array("workgeneric", "termgeneric") as $cls){
if (isset($this->tabObject->by_object[$cls])){
$this->tabObject->by_object[$cls]->set_everything_to_inherited();
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ $og->dn, "<b>Calling {$cls}->set_everything_to_inherited()</b>");
}
}
foreach (array("servgeneric", "workgeneric", "termgeneric") as $cls){
if (isset($this->tabObject->by_object[$cls])){
$this->tabObject->by_object[$cls]->auto_activate= TRUE;
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ $cls, "<b>Setting auto_activate=TRUE for</b>");
}
}
// Enable sending of LDAP events
if (isset($this->tabObject->by_object["workstartup"])){
$this->tabObject->by_object["workstartup"]->gotoLdap_inherit= TRUE;
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ "", "<b>Setting workstartup->gotoLdap_inherit=TRUE</b>");
}
}
// There was a problem, skip activation here and allow to fix the problems..
if(is_object($this->tabObject)){
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ "", "<b>Automatic saving failed, let the user fix the issues now.</b>");
return;
}
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ "", "<b>System activated!</b>");
}else{
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ "", "<b>Open dialogs now</b>");
return;
}
}
protected function saveChanges()
{
-
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ get_class($this->tabObject).": ".$this->tabObject->dn, "<b>Save</b>");
+
// Handle 'New Unknown Devices' here.
if($this->tabObject instanceOf ArpNewDeviceTabs){
$this->tabObject->save_object();
if(count($message)){
msg_dialog::displayChecks($message);
}else{
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ get_class($this->tabObject).": ".$this->tabObject->dn, "<b>Queued for goto activation</b>");
$this->tabObject->save();
$this->activationQueue[$this->tabObject->dn]=array();
$this->closeDialogs();
$this->systemTypeChosen();
-
}
return;
}
if($this->tabObject) return("");
if(isset($this->activationQueue[$this->last_dn])){
- $this->activate_new_device($this->last_dn);
+ $dn = $this->last_tabObject->dn;
+ $this->activate_new_device($dn);
unset($this->activationQueue[$this->last_dn]);
}
*/
function activate_new_device($dn)
{
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ $dn, "<b>Activating system:</b>");
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$ldap->cat($dn);
if($ldap->count()){
$attrs = $ldap->fetch();
- if(count(array_intersect(array('goServer','gotoTerminal'), $attrs['objectClass']))){
+ if(count(array_intersect(array('goServer','gotoWorkstation'), $attrs['objectClass']))){
$ocs = $attrs['objectClass'];
unset($ocs['count']);
$new_attrs = array();
if (!$ldap->success()){
msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn,
LDAP_MOD, "activate_new_device($dn)"));
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ $dn, "<b>Failed!</b>");
}else{
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ $dn, "<b>Success</b>");
return(TRUE);
}
+ }else{
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,
+ $dn, "<b>FAIstate not set to install, this is only done for gotoWorkstation/goServer!</b>");
}
}
return(FALSE);