From: hickert Date: Wed, 26 Jul 2006 10:47:09 +0000 (+0000) Subject: Implemented new acls into opengroupware Account X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9d381b1a86acac10b53c40746b1fc8789063beac;p=gosa.git Implemented new acls into opengroupware Account git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4314 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/personal/connectivity/class_opengwAccount.inc b/plugins/personal/connectivity/class_opengwAccount.inc index e282f0c45..3b5f87470 100644 --- a/plugins/personal/connectivity/class_opengwAccount.inc +++ b/plugins/personal/connectivity/class_opengwAccount.inc @@ -118,18 +118,18 @@ class opengwAccount extends plugin /* Show tab dialog headers */ $display= ""; $smarty= get_smarty(); - print_red(_("New ACLs are not implemeneted yet.")); /* set default values */ - foreach(array("validLocationTeam","validTemplateUser","validLocationTeams","validTemplateUsers") as $ar){ - $smarty->assign($ar,array()); - } - $smarty->assign("OGWstate"," disabled "); - foreach(array("LocationTeam","TemplateUser","is_locked","validTeams","opengwAccount","is_account"/*,"OGWPassword"*/) as $ar){ - $smarty->assign($ar,""); - $smarty->assign($ar."CHK",""); - $smarty->assign($ar."ACL"," disabled "); - } + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $acl => $desc){ + $smarty->assign($acl."ACL",$this->getacl($acl,$this->ReadOnly)); + } + + if((!$this->ReadOnly)&&($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) { + $smarty->assign('opengwAccountACL', ""); + }else{ + $smarty->assign('opengwAccountACL', " disabled "); + } /* Check database extension */ if(!is_callable("pg_connect")){ @@ -149,12 +149,6 @@ class opengwAccount extends plugin print_red(_("OpenGroupware: Can't connect to specified database. Please check given configuration twice.")); }else{ - /* Show main page */ - $smarty->assign("OGWstate"," disabled "); - foreach(array("LocationTeam","TemplateUser","is_locked","validTeams","opengwAccount"/*,"OGWPassword"*/) as $ar){ - $smarty->assign($ar."ACL",chkacl($this->acl,$ar)); - } - /* Assign LocationTeams */ $tmp = array(""=>"none"); foreach($this->handle->validLocationTeam as $id){ @@ -175,21 +169,23 @@ class opengwAccount extends plugin /* Create Team membership */ $str = ""; - if(($this->is_account)&&(chkacl($this->acl,"TeamIDs")=="")){ + if(($this->is_account)==""){ $dis = ""; }else{ $dis = " disabled "; } - foreach($this->handle->validTeams as $id){ - if(in_array($id['company_id'],$this->info['TeamIDis'])){ - $str .= "".$id['description']."
"; - }else{ - $str .= "".$id['description']."
"; - } - } + if($this->acl_is_readable("Teams")){ + foreach($this->handle->validTeams as $id){ + if(in_array($id['company_id'],$this->info['TeamIDis'])){ + $str .= "".$id['description']."
"; + }else{ + $str .= "".$id['description']."
"; + } + } + } $smarty->assign("validTeams",$str); /* Assign ogw checkbox */ @@ -201,11 +197,6 @@ class opengwAccount extends plugin $smarty->assign("OGWstate"," disabled "); } - /* Assign acls */ - foreach(array("LocationTeam","TemplateUser","Teams","is_locked") as $atr){ - $smarty->assign($atr."ACL",chkacl($this->acl,$atr)); - } - /* Assign lock status */ if($this->info['is_locked']){ $smarty->assign("is_lockedCHK", " checked "); @@ -216,21 +207,6 @@ class opengwAccount extends plugin } } - /* - if($this->SetPassword == false){ - if($_SESSION['js'] == 1){ - $smarty->assign("OGWPasswordACL"," disabled "); - }else{ - $smarty->assign("OGWPasswordACL",""); - } - $smarty->assign("OGWPassword",""); - $smarty->assign("OGWPasswordCHK"," "); - }else{ - $smarty->assign("OGWPasswordACL",""); - $smarty->assign("OGWPassword",$this->OGWPassword); - $smarty->assign("OGWPasswordCHK"," checked "); - } - */ $display.= $smarty->fetch (get_template_path('opengw.tpl', TRUE, dirname(__FILE__))); return ($display); } @@ -252,60 +228,49 @@ class opengwAccount extends plugin /* get post data */ if($this->is_account){ - /* - if(isset($_POST['SetPassword'])){ - $this->SetPassword =true; - }else{ - $this->SetPassword = false; - } - - if((isset($_POST['OGWPassword']))&&($this->SetPassword)){ - $this->OGWPassword = $_POST['OGWPassword']; - $pwd = new passwordMethodCrypt($this->config); - - $this->info['password'] = preg_replace("/^{crypt}/","",$pwd->generate_hash($_POST['OGWPassword'])); - }else{ - if(isset($this->info['password'])){ - unset($this->info['password']); + /* Get selected team chkboxes */ + $this->info['TeamIDis'] = array(); + if($this->acl_is_writeable("Teams")) { + foreach($_POST as $name => $value ){ + if(preg_match("/team_/i",$name)){ + if(!in_array($value,$this->info['TeamIDis'])){ + $this->info['TeamIDis'][]=$value; + } + } } } - */ - - /* Get selected team chkboxes */ - $this->info['TeamIDis'] = array(); - foreach($_POST as $name => $value ){ - if(preg_match("/team_/i",$name)){ - if(!in_array($value,$this->info['TeamIDis'])){ - $this->info['TeamIDis'][]=$value; - } - } - } + /* Get location Team*/ - if(isset($_POST['LocationTeam'])){ + if(isset($_POST['LocationTeam']) && $this->acl_is_writeable("LocationTeam")){ $this->info['LocationTeamID'] = $_POST['LocationTeam']; } /* Get template user */ - if(isset($_POST['TemplateUser'])){ + if(isset($_POST['TemplateUser']) && $this->acl_is_writeable("TemplateUser") ){ $this->info['template_user_id'] = $_POST['TemplateUser']; } - /* get lock status */ - if(isset($_POST['is_locked'])){ - $this->info['is_locked'] = $_POST['is_locked']; - }else{ - $this->info['is_locked'] = 0; - } + /* get lock status */ + if($this->acl_is_writeable("Locked")){ + if(isset($_POST['is_locked'])){ + $this->info['is_locked'] = $_POST['is_locked']; + }else{ + $this->info['is_locked'] = 0; + } + } } /* change account status */ if(isset($_POST['is_account'])){ - $this->is_account = $_POST['is_account']; - }else{ - $this->is_account = false;//$_POST['is_account']; + if($this->acl_is_createable()){ + $this->is_account = $_POST['is_account']; + } + }else{ + if($this->acl_is_removeable()){ + $this->is_account = false;//$_POST['is_account']; + } } - } @@ -344,7 +309,10 @@ class opengwAccount extends plugin "plOptions" => array(), "plProvidedAcls" => array( - "opengwAccount" => "!!! FIXME "._("Open groupware account")) + "LocationTeam" => _("Location team"), + "TemplateUser" => _("Template user"), + "Locked" => _("Locked"), + "Teams" => _("Teams")) )); } } diff --git a/plugins/personal/connectivity/opengw.tpl b/plugins/personal/connectivity/opengw.tpl index 5744875a9..568741719 100644 --- a/plugins/personal/connectivity/opengw.tpl +++ b/plugins/personal/connectivity/opengw.tpl @@ -8,12 +8,12 @@ {t}Location team{/t}   +{render acl=$LocationTeamACL} +{/render} @@ -21,12 +21,11 @@ {t}Template user{/t}   - {html_options values=$validTemplateUsers output=$validTemplateUser selected=$TemplateUser} +{/render} @@ -34,10 +33,10 @@ {t}Locked{/t}   +{render acl=$LockedACL} + {if $OGWstate!=""} disabled {/if}> +{/render} @@ -49,7 +48,9 @@ {t}Teams{/t}   +{render acl=$TeamsACL} {$validTeams} +{/render}