From a83d0770b8785a84592c26cf0627164dc243dbcf Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 1 Jul 2008 12:43:38 +0000 Subject: [PATCH] Ensure that the currenlty selected profile server stays selected after saving, even if we have not the permissions to view the server. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11496 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../environment/class_environment.inc | 24 ++++++++++++++++++- .../goto/personal/environment/environment.tpl | 18 ++++++++------ 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/gosa-plugins/goto/personal/environment/class_environment.inc b/gosa-plugins/goto/personal/environment/class_environment.inc index f3a1d06ea..21ecc93f1 100644 --- a/gosa-plugins/goto/personal/environment/class_environment.inc +++ b/gosa-plugins/goto/personal/environment/class_environment.inc @@ -236,7 +236,27 @@ class environment extends plugin $this->gotoProfileServers= $config->getShareServerList() ; $this->gotoShareSelections= $config->getShareList(true); $this->gotoAvailableShares= $config->getShareList(false); + + /* Ensure that a currently selected server will stay selected, even if the list of profile servers + is empty due to insufficient permissions. + */ + if(count($this->gotoProfileServers) && !empty($this->gotoProfileServer)){ + + /* The currently selected profile server is outdated/no longer available */ + if(!isset($this->gotoProfileServers[$this->gotoProfileServer])){ + }else{ + $c = $this->gotoProfileServers[$this->gotoProfileServer]; + if(!preg_match("/r/",$c['ACL'])){ + + /* We are not allowed to read to currently selected server. + But to ensure that the selection will be kept after saving the account, we + override the current ACL tag. + */ + $this->gotoProfileServers[$this->gotoProfileServer]['ACL'] .= "r"; + } + } + } $this->update_kiosk_profiles(); } @@ -322,7 +342,10 @@ class environment extends plugin /* Check profile server */ if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){ + if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){ + + if(count($this->gotoProfileServers)){ /* Get First Profile */ @@ -535,7 +558,6 @@ class environment extends plugin if(!is_array($this->gotoProfileServers)){ $this->gotoProfileServers =array(); } - $smarty->assign("gotoProfileServerKeys",array_flip($this->gotoProfileServers)); /* Handle kiosk profiles*/ $smarty->assign("kiosk_servers" , $this->gotoKioskProfiles['SERVERS']); diff --git a/gosa-plugins/goto/personal/environment/environment.tpl b/gosa-plugins/goto/personal/environment/environment.tpl index afb1f64dc..d1ed3aa35 100644 --- a/gosa-plugins/goto/personal/environment/environment.tpl +++ b/gosa-plugins/goto/personal/environment/environment.tpl @@ -24,9 +24,12 @@
{render acl=$gotoProfileServerACL checkbox=$multiple_support checked=$use_gotoProfileServer} {t}Profil path{/t} - + {/render}
{render acl=$gotoProfileQuotaACL checkbox=$multiple_support checked=$use_gotoProfileQuota} @@ -66,13 +69,14 @@ {if $gotoProfileServerWriteable} {else} - + {/if} {/render} -- 2.30.2