diff --git a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc
index 83c870da17c6137e74b62cee7b90e61a0ccd0623..78ec8dede967db3de03095669ac666ad1e540fdb 100644 (file)
/* Definitions */
var $plHeadline = "Applications";
var $plDescription = "This does something";
/* Definitions */
var $plHeadline = "Applications";
var $plDescription = "This does something";
+ var $plIcon = "plugins/goto/images/application.png";
/* Dialog attributes */
var $apptabs = NULL;
/* Dialog attributes */
var $apptabs = NULL;
var $enableReleaseManagement = false;
var $start_pasting_copied_objects = FALSE;
var $enableReleaseManagement = false;
var $start_pasting_copied_objects = FALSE;
+ var $acl_base ="";
var $app_base ="";
var $app_release ="";
var $app_base ="";
var $app_release ="";
+ var $acl_module = array("application");
+
+ var $dns = array();
function IsReleaseManagementActivated()
{
function IsReleaseManagementActivated()
{
if(!empty($tmp)){
return(true);
}
if(!empty($tmp)){
return(true);
}
+ return(false);
}
}
$this->ui = &$ui;
/* Check if copy & paste is activated */
$this->ui = &$ui;
/* Check if copy & paste is activated */
- if($this->config->boolValueIsTrue("MAIN","ENABLECOPYPASTE")){
+ if($this->config->boolValueIsTrue("MAIN","COPYPASTE")){
$this->CopyPasteHandler = new CopyPasteHandler($this->config);
}
$this->CopyPasteHandler = new CopyPasteHandler($this->config);
}
$this->DivListApplication = new divListApplication($this->config,$this);
if($this->IsReleaseManagementActivated()){
$this->DivListApplication = new divListApplication($this->config,$this);
if($this->IsReleaseManagementActivated()){
- /* Check if we should enable the release selection */
+ $this->acl_base = $this->config->current['BASE'];
+
+ /* Check if we should enable the release selection */
$this->enableReleaseManagement = true;
/* Hide SubSearch checkbox */
$this->DivListApplication->DisableCheckBox("SubSearch");
$this->enableReleaseManagement = true;
/* Hide SubSearch checkbox */
$this->DivListApplication->DisableCheckBox("SubSearch");
+ }else{
+ $this->acl_base = &$this->DivListApplication->selectedBase;
}
/* Set default release */
if(!$this->IsReleaseManagementActivated()){
}
/* Set default release */
if(!$this->IsReleaseManagementActivated()){
- $this->app_base = get_ou("applicationou").$this->config->current['BASE'];
+ $this->app_base = get_ou("applicationRDN").$this->config->current['BASE'];
if(!session::is_set("app_filter")){
session::set("app_filter",array("app_base" => $this->app_base));
}
$app_filter = session::get("app_filter");
if(!session::is_set("app_filter")){
session::set("app_filter",array("app_base" => $this->app_base));
}
$app_filter = session::get("app_filter");
- $this->app_base = $app_filter['app_base'];
}else{
}else{
- $this->app_base = get_ou("applicationou").$this->config->current['BASE'];
+
+ /* Set intial release */
+ $this->app_base = get_ou("applicationRDN").$this->config->current['BASE'];
+ $rel = $config->search("faiManagement","DEFAULTFAIRELEASE",array("menu"));
+ $rels = array_flip($this->getReleases());
+ if(isset($rels[$rel])){
+ $rel = $rels[$rel];
+ }else{
+ $rel = $this->app_base;
+ }
+
if(!session::is_set("app_filter")){
if(!session::is_set("app_filter")){
- session::set("app_filter",array("app_base" => $this->app_base,"app_release" => $this->app_base));
+ session::set("app_filter",array("app_base" => $this->app_base,"app_release" => $rel));
}
$app_filter = session::get("app_filter");
$this->app_base = $app_filter['app_base'];
$this->app_release = $app_filter['app_release'];
}
}
$app_filter = session::get("app_filter");
$this->app_base = $app_filter['app_base'];
$this->app_release = $app_filter['app_release'];
}
- $this->app_base = "ou=apps,ou=Direktorium,o=Landeshauptstadt München,c=de";
- $this->app_release= $this->app_base;
}
}
/* These vars will be stored if you try to open a locked app,
to be able to perform your last requests after showing a warning message */
/* These vars will be stored if you try to open a locked app,
to be able to perform your last requests after showing a warning message */
- session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/"));
+ session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/","/^menu_action/"));
$smarty = get_smarty(); // Smarty instance
$s_action = ""; // Contains the action to proceed
$smarty = get_smarty(); // Smarty instance
$s_action = ""; // Contains the action to proceed
/* Create new usertab object */
$this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
$this->apptabs->parent = &$this;
/* Create new usertab object */
$this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
$this->apptabs->parent = &$this;
- $this->apptabs->set_acl_base($this->app_base);
+ $this->apptabs->set_acl_base($this->acl_base);
}
}
/* Cancel dialogs */
if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
/* Cancel dialogs */
if (isset($_POST['edit_cancel']) || isset($_POST['password_cancel'])){
- del_lock ($this->apptabs->dn);
- unset ($this->apptabs);
+ $this->remove_lock();
$this->apptabs= NULL;
session::un_set('objectinfo');
}
$this->apptabs= NULL;
session::un_set('objectinfo');
}
/* Application has been saved successfully, remove lock from
LDAP. */
if ($this->dn != "new"){
/* Application has been saved successfully, remove lock from
LDAP. */
if ($this->dn != "new"){
- del_lock ($this->dn);
+ $this->remove_lock();
}
}
- unset ($this->apptabs);
$this->apptabs= NULL;
session::un_set('objectinfo');
$this->apptabs= NULL;
session::un_set('objectinfo');
+ }else{
+
+ /* Reinitialize tab */
+ if($this->apptabs instanceof tabs){
+ $this->apptabs->re_init();
+ }
}
} else {
/* Ok. There seem to be errors regarding to the tab data,
}
} else {
/* Ok. There seem to be errors regarding to the tab data,
/* Register apptabs to trigger edit dialog */
$this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
/* 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);
$this->apptabs->parent = &$this;
$this->apptabs->set_acl_base($this->dn);
session::set('objectinfo',$this->dn);
$ids = $this->list_get_selected_items();
if(count($ids)){
$ids = $this->list_get_selected_items();
if(count($ids)){
+ $this->dns = array();
+ $disallowed = array();
foreach($ids as $id){
$dn = $this->applications[$id]['dn'];
foreach($ids as $id){
$dn = $this->applications[$id]['dn'];
- $this->dns[$id] = $dn;
- }
- if ($user= get_multiple_locks($this->dns)){
- return(gen_locked_message($user,$this->dns));
+ $acl = $this->ui->get_permissions($dn, "application/application");
+ if(preg_match("/d/",$acl)){
+ $this->dns[$id] = $dn;
+ }else{
+ $disallowed[] = $dn;
+ }
}
}
- $dns_names[] = array();
- foreach($this->dns as $dn){
- add_lock ($dn, $this->ui->dn);
- $dns_names[] =@LDAP::fix($dn);
+ if(count($disallowed)){
+ msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
}
}
- /* Lock the current entry, so nobody will edit it during deletion */
- $smarty->assign("intro", msgPool::deleteInfo($dns_names,_("application")));
- $smarty->assign("multiple", true);
- return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ if(count($this->dns)){
+
+ if ($user= get_multiple_locks($this->dns)){
+ return(gen_locked_message($user,$this->dns));
+ }
+
+ $dns_names = array();
+ foreach($this->dns as $dn){
+ add_lock ($dn, $this->ui->dn);
+ $dns_names[] =LDAP::fix($dn);
+ }
+
+ /* Lock the current entry, so nobody will edit it during deletion */
+ $smarty->assign("intro", msgPool::deleteInfo($dns_names,_("application")));
+ $smarty->assign("multiple", true);
+ return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ }
}
}
}
}
msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
}
msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
}
- /* Remove lock file after successfull deletion */
- del_lock ($dn);
- unset($this->dns[$key]);
}
}
+
+ /* Remove lock file after successfull deletion */
+ $this->remove_lock();
+ $this->dns = array();
}
}
/* Remove lock */
if(isset($_POST['delete_multiple_application_cancel'])){
/* Remove lock */
if(isset($_POST['delete_multiple_application_cancel'])){
- foreach($this->dns as $key => $dn){
- del_lock ($dn);
- unset($this->dns[$key]);
- }
+
+ /* Remove lock file after successfull deletion */
+ $this->remove_lock();
+ $this->dns = array();
}
/****************
}
/****************
/* Lock the current entry, so nobody will edit it during deletion */
add_lock ($this->dn, $this->ui->dn);
$smarty= get_smarty();
/* Lock the current entry, so nobody will edit it during deletion */
add_lock ($this->dn, $this->ui->dn);
$smarty= get_smarty();
- $smarty->assign("intro",msgPool::deleteInfo(@LDAP::fix($this->dn),_("application")));
+ $smarty->assign("intro",msgPool::deleteInfo(LDAP::fix($this->dn),_("application")));
$smarty->assign("multiple", false);
return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
} else {
$smarty->assign("multiple", false);
return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
} else {
}
/* Remove lock file after successfull deletion */
}
/* Remove lock file after successfull deletion */
- del_lock ($this->dn);
+ $this->remove_lock();
}
}
/* Delete application canceled? */
if (isset($_POST['delete_cancel'])){
/* Delete application canceled? */
if (isset($_POST['delete_cancel'])){
- del_lock ($this->dn);
+ $this->remove_lock();
session::un_set('objectinfo');
}
session::un_set('objectinfo');
}
/* Don't show buttons if tab dialog requests this */
if (!$this->apptabs->by_object[$this->apptabs->current]->dialog){
$display.= "<p style=\"text-align:right\">\n";
/* Don't show buttons if tab dialog requests this */
if (!$this->apptabs->by_object[$this->apptabs->current]->dialog){
$display.= "<p style=\"text-align:right\">\n";
- $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
- $display.= " \n";
- if ($this->dn != "new"){
- $display.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
+
+ if(isset($this->apptabs->FAIstate) && !preg_match("/freeze/i",$this->apptabs->FAIstate)){
+ $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
$display.= " \n";
$display.= " \n";
+ if ($this->dn != "new"){
+ $display.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
+ $display.= " \n";
+ }
}
$display.= "<input type=\"submit\" name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
$display.= "</p>";
}
$display.= "<input type=\"submit\" name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
$display.= "</p>";
}else{
$base = $this->app_base;
}
}else{
$base = $this->app_base;
}
- if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases())){
+ if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases(),$this)){
return($str);
}
return($str);
}
if(!$this->IsReleaseManagementActivated()){
$use_base = $this->app_base;
if(!$this->IsReleaseManagementActivated()){
$use_base = $this->app_base;
+ if($SubSearch){
+ $use_base = preg_replace("/^".preg_quote(get_ou("applicationRDN"), '/')."/","",$use_base);
+ }
}else{
$use_base = $this->app_release;
}else{
$use_base = $this->app_release;
+ $SubSearch= FALSE;
}
}
- if($SubSearch){
- $Flags |= GL_SUBSEARCH;
+ /* 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("applicationRDN"), $use_base, $search_attrs, $Flags);
+ }else{
+ $res= get_list($Filter, "application",$use_base, $search_attrs, $Flags);
}
}
-
- $res= get_list($Filter, "application", $use_base, array("cn","description","dn","objectClass"), $Flags);
$tmp2 = array();
foreach ($res as $val){
$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'];
}
$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'];
}
return("");
}
return("");
}
+ $ui = get_userinfo();
+
/* Add a single entry to queue */
if($s_action == "cut" || $s_action == "copy"){
/* Cleanup object queue */
$this->CopyPasteHandler->cleanup_queue();
$dn = $this->applications[$s_entry]['dn'];
/* Add a single entry to queue */
if($s_action == "cut" || $s_action == "copy"){
/* Cleanup object queue */
$this->CopyPasteHandler->cleanup_queue();
$dn = $this->applications[$s_entry]['dn'];
- $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
+ if($s_action == "copy" && $ui->is_copyable($dn,"application","application")){
+ $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
+ }
+ if($s_action == "cut" && $ui->is_cutable($dn,"application","application")){
+ $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
+ }
}
}
foreach($this->list_get_selected_items() as $id){
$dn = $this->applications[$id]['dn'];
foreach($this->list_get_selected_items() as $id){
$dn = $this->applications[$id]['dn'];
- if($s_action == "copy_multiple"){
+ if($s_action == "copy_multiple" && $ui->is_copyable($dn,"application","application")){
$this->CopyPasteHandler->add_to_queue($dn,"copy","apptabs","APPSTABS","application");
}
$this->CopyPasteHandler->add_to_queue($dn,"copy","apptabs","APPSTABS","application");
}
- if($s_action == "cut_multiple"){
+ if($s_action == "cut_multiple" && $ui->is_cutable($dn,"application","application")){
$this->CopyPasteHandler->add_to_queue($dn,"cut","apptabs","APPSTABS","application");
}
}
$this->CopyPasteHandler->add_to_queue($dn,"cut","apptabs","APPSTABS","application");
}
}
/* Get dialog */
$this->CopyPasteHandler->SetVar("base",$this->app_base);
/* Get dialog */
$this->CopyPasteHandler->SetVar("base",$this->app_base);
- $this->CopyPasteHandler->SetVar("parent",&$this);
+ $this->CopyPasteHandler->SetVar("parent",$this);
$data = $this->CopyPasteHandler->execute();
/* Return dialog data */
$data = $this->CopyPasteHandler->execute();
/* Return dialog data */
$this->postcreate();
}
$this->postcreate();
}
+
function remove_lock()
{
if (isset($this->apptabs->dn)){
del_lock ($this->apptabs->dn);
}
function remove_lock()
{
if (isset($this->apptabs->dn)){
del_lock ($this->apptabs->dn);
}
+ if(isset($this->dn) && !empty($this->dn) && $this->dn != "new"){
+ del_lock($this->dn);
+ }
+ if(isset($this->dns) && is_array($this->dns) && count($this->dns)){
+ del_lock($this->dns);
+ }
}
}
+
function save_object()
{
$this->DivListApplication->save_object();
function save_object()
{
$this->DivListApplication->save_object();
if(isset($releases[$sel_rel])){
$this->app_release = $releases[$sel_rel];
}
if(isset($releases[$sel_rel])){
$this->app_release = $releases[$sel_rel];
}
+ $app_filter = session::get("app_filter");
+ $app_filter['app_release'] = $this->app_release;
+ session::set("app_filter",$app_filter);
}elseif(!$this->IsReleaseManagementActivated()){
}elseif(!$this->IsReleaseManagementActivated()){
- $this->app_base = get_ou("applicationou").$this->DivListApplication->selectedBase;
+ $this->app_base = get_ou("applicationRDN").$this->DivListApplication->selectedBase;
+ $app_filter = session::get("app_filter");
+ $app_filter['app_base'] = $this->app_base;
+ session::set("app_filter",$app_filter);
}
}
}
}