From 32c19e57b5b42557adcb45b5629020498ab6fd2b Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 17 Jul 2008 13:10:40 +0000 Subject: [PATCH] Application. -Implemented freeze handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11706 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../applications/class_applicationGeneric.inc | 11 +++++-- .../class_applicationManagement.inc | 29 ++++++++++++++----- .../applications/class_divListApplication.inc | 23 +++++++++++++-- .../admin/applications/tabs_application.inc | 11 ++++++- 4 files changed, 60 insertions(+), 14 deletions(-) diff --git a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc b/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc index 5995d1607..4cf072e49 100644 --- a/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc +++ b/gosa-plugins/goto/admin/applications/class_applicationGeneric.inc @@ -26,6 +26,7 @@ class application extends plugin "gosaApplicationFlags","gotoLogonScript"); var $objectclasses= array("top", "gosaApplication"); + var $FAIstate =""; function application (&$config, $dn= NULL, $parent= NULL) { @@ -115,7 +116,7 @@ class application extends plugin $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $name => $translation){ - $smarty->assign($name."ACL",$this->getacl($name)); + $smarty->assign($name."ACL",$this->getacl($name, preg_match("/freeze/i",$this->FAIstate))); } /* Do we represent a valid group? */ @@ -144,7 +145,7 @@ class application extends plugin $head = $this->generateTemplate(); $this->gotoLogonScript= $this->generateTemplate().preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript); - if((isset($_POST['upLoad']))&&(isset($_FILES['ScriptFile']))){ + if((isset($_POST['upLoad']))&&(isset($_FILES['ScriptFile'])) && !preg_match("/freeze/i",$this->FAIstate)){ $str = file_get_contents($_FILES['ScriptFile']['tmp_name']); $this->gotoLogonScript = $str; } @@ -167,7 +168,7 @@ class application extends plugin /* Base select dialog */ $once = true; foreach($_POST as $name => $value){ - if(preg_match("/^chooseBase/",$name) && $once){ + if(preg_match("/^chooseBase/",$name) && $once && !preg_match("/freeze/i",$this->FAIstate)){ $once = false; $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases()); $this->dialog->setCurrentBase($this->base); @@ -288,6 +289,10 @@ class application extends plugin /* Save data to object */ function save_object() { + if(preg_match("/freeze/i",$this->FAIstate)){ + return; + } + if (isset($_POST['cn'])){ /* Create a base backup and reset the diff --git a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc index b4f83907f..b7f040d78 100644 --- a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc +++ b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc @@ -302,6 +302,9 @@ class applicationManagement extends plugin /* Register apptabs to trigger edit dialog */ $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application"); + if($this->IsReleaseManagementActivated()){ + $this->apptabs->set_FAIstate($this->applications[$s_entry]['FAIstate'][0]); + } $this->apptabs->parent = &$this; $this->apptabs->set_acl_base($this->dn); session::set('objectinfo',$this->dn); @@ -492,11 +495,14 @@ class applicationManagement extends plugin /* Don't show buttons if tab dialog requests this */ if (!$this->apptabs->by_object[$this->apptabs->current]->dialog){ $display.= "

\n"; - $display.= "\n"; - $display.= " \n"; - if ($this->dn != "new"){ - $display.= "\n"; + + if(isset($this->apptabs->FAIstate) && !preg_match("/freeze/i",$this->apptabs->FAIstate)){ + $display.= "\n"; $display.= " \n"; + if ($this->dn != "new"){ + $display.= "\n"; + $display.= " \n"; + } } $display.= "\n"; $display.= "

"; @@ -562,14 +568,23 @@ class applicationManagement extends plugin $use_base = $this->app_release; $SubSearch= FALSE; } - + + /* Add FAIstate to the search attributes */ + $search_attrs = array("cn","description","dn","objectClass"); + if($this->IsReleaseManagementActivated()) { + $search_attrs[] = "FAIstate"; + } + if($SubSearch){ - $res= get_sub_list($Filter, "application",get_ou("applicationou"), $use_base, array("cn","description","dn","objectClass"), $Flags); + $res= get_sub_list($Filter, "application",get_ou("applicationou"), $use_base, $search_attrs, $Flags); }else{ - $res= get_list($Filter, "application",$use_base, array("cn","description","dn","objectClass"), $Flags); + $res= get_list($Filter, "application",$use_base, $search_attrs, $Flags); } $tmp2 = array(); foreach ($res as $val){ + if(!isset($val['FAIstate'])){ + $val['FAIstate'][0] = ""; + } $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val; $tmp2[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']] = strtolower($val['cn'][0]).$val['cn'][0].$val['dn']; } diff --git a/gosa-plugins/goto/admin/applications/class_divListApplication.inc b/gosa-plugins/goto/admin/applications/class_divListApplication.inc index 24d55ef24..cb096f5c6 100644 --- a/gosa-plugins/goto/admin/applications/class_divListApplication.inc +++ b/gosa-plugins/goto/admin/applications/class_divListApplication.inc @@ -160,21 +160,38 @@ class divListApplication extends MultiSelectWindow $acl = $ui->get_permissions($val['dn'],"application/application"); $acl_all= $ui->has_complete_category_acls($val['dn'],"application"); + /* Check FAI state + */ + $FAIstate = $val['FAIstate'][0]; + /* Create action icons */ $actions= ""; /* Add copy & cut functionality */ - $actions.= $this->parent->get_copypaste_action($val['dn'],"application","application"); + if(!preg_match("/freeze/i",$FAIstate)){ + $actions.= $this->parent->get_copypaste_action($val['dn'],"application","application"); + }else{ + $actions.= " "; + $actions.= " "; + } /* Add edit icon */ $actions.= ""; /* Add snapshot icon */ - $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module); + if(!preg_match("/freeze/i",$FAIstate)){ + $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module); + }else{ + $actions.= " "; + $actions.= " "; + } + /* If we are allowed to remove the application account, display remove icon */ - if(preg_match("/d/",$acl)){ + if(preg_match("/freeze/i",$FAIstate)){ + $actions .= "!"; + }elseif(preg_match("/d/",$acl)){ $actions.= ""; }else{ diff --git a/gosa-plugins/goto/admin/applications/tabs_application.inc b/gosa-plugins/goto/admin/applications/tabs_application.inc index 9636c44db..53b0916cd 100644 --- a/gosa-plugins/goto/admin/applications/tabs_application.inc +++ b/gosa-plugins/goto/admin/applications/tabs_application.inc @@ -2,7 +2,8 @@ class apptabs extends tabs { - var $parent = FALSE; + var $parent = FALSE; + var $FAIstate = ""; function apptabs($config, $data, $dn,$category) { @@ -12,6 +13,14 @@ class apptabs extends tabs $this->addSpecialTabs(); } + function set_FAIstate($state) + { + $this->FAIstate = $state; + foreach($this->by_name as $name => $desc){ + $this->by_object[$name]->FAIstate = $state; + } + } + function save($ignore_account= FALSE) { $baseobject= $this->by_object['application']; -- 2.30.2