From 02c7022caef041417098acf2a6e36df6f4efc5d5 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 30 Nov 2005 07:27:37 +0000 Subject: [PATCH] Fixed ACL stuff for connectivity tab git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2137 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../connectivity/class_connectivity.inc | 1 - .../connectivity/class_intranetAccount.inc | 46 +++++++------- .../connectivity/class_phpgwAccount.inc | 19 ++---- .../class_phpscheduleitAccount.inc | 4 -- .../connectivity/class_pptpAccount.inc | 63 +++++++++---------- .../connectivity/class_proxyAccount.inc | 44 ++++++++++++- .../connectivity/class_pureftpdAccount.inc | 31 +++++---- .../connectivity/class_webdavAccount.inc | 61 +++++++++--------- plugins/personal/connectivity/intranet.tpl | 5 +- plugins/personal/connectivity/phpgw.tpl | 5 +- .../personal/connectivity/phpscheduleit.tpl | 5 +- plugins/personal/connectivity/pptp.tpl | 5 +- plugins/personal/connectivity/proxy.tpl | 30 +++------ plugins/personal/connectivity/pureftpd.tpl | 6 +- plugins/personal/connectivity/webdav.tpl | 5 +- 15 files changed, 188 insertions(+), 142 deletions(-) diff --git a/plugins/personal/connectivity/class_connectivity.inc b/plugins/personal/connectivity/class_connectivity.inc index 767d50d5d..1cad08b5d 100644 --- a/plugins/personal/connectivity/class_connectivity.inc +++ b/plugins/personal/connectivity/class_connectivity.inc @@ -76,7 +76,6 @@ class connectivity extends plugin /* Execude objects */ $is_first= true; foreach ($this->plugin_name as $name){ - if (!$this->plugin[$name]->is_account && $this->parent == NULL) continue; if (!$is_first){ $display.= '

 

'; } else { diff --git a/plugins/personal/connectivity/class_intranetAccount.inc b/plugins/personal/connectivity/class_intranetAccount.inc index 68644e122..067b3ed07 100644 --- a/plugins/personal/connectivity/class_intranetAccount.inc +++ b/plugins/personal/connectivity/class_intranetAccount.inc @@ -89,17 +89,19 @@ class intranetAccount extends plugin */ function remove_from_parent() { - plugin::remove_from_parent(); - $ldap= $this->config->get_ldap_link(); - - $ldap->cd($this->dn); - @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, - $this->attributes, "Save"); - $ldap->modify($this->attrs); - show_ldap_error($ldap->get_error()); - - /* Optionally execute a command after we're done */ - $this->postremove(); + if(chkacl($this->acl, 'intranetAccount') == ""){ + plugin::remove_from_parent(); + $ldap= $this->config->get_ldap_link(); + + $ldap->cd($this->dn); + @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, + $this->attributes, "Save"); + $ldap->modify($this->attrs); + show_ldap_error($ldap->get_error()); + + /* Optionally execute a command after we're done */ + $this->postremove(); + } } @@ -141,16 +143,18 @@ class intranetAccount extends plugin */ function save() { - plugin::save(); - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - show_ldap_error($ldap->get_error()); - - /* Optionally execute a command after we're done */ - $this->postcreate(); + if(chkacl($this->acl, 'intranetAccount') == ""){ + plugin::save(); + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $ldap->modify($this->attrs); + show_ldap_error($ldap->get_error()); + + /* Optionally execute a command after we're done */ + $this->postcreate(); + } } } diff --git a/plugins/personal/connectivity/class_phpgwAccount.inc b/plugins/personal/connectivity/class_phpgwAccount.inc index aa38d1878..4e79a2f12 100644 --- a/plugins/personal/connectivity/class_phpgwAccount.inc +++ b/plugins/personal/connectivity/class_phpgwAccount.inc @@ -28,7 +28,7 @@ class phpgwAccount extends plugin { /* Call parent execute */ // plugin::execute(); - + /* Show tab dialog headers */ $display= ""; @@ -44,13 +44,6 @@ class phpgwAccount extends plugin $smarty->assign("phpgwState", "checked"); } else { $smarty->assign("phpgwState", ""); - $smarty->assign("fstate", "disabled"); - } - - if ($this->parent != NULL){ - $smarty->assign("tabbed", 1); - }else{ - $smarty->assign("tabbed", 0); } $smarty->assign('phpgwAccountACL', chkacl($this->acl, 'phpgwAccount')); @@ -61,7 +54,7 @@ class phpgwAccount extends plugin function remove_from_parent() { - if ($this->parent != NULL){ + if(chkacl($this->acl,"phpgwAccount") == ""){ /* Cancel if there's nothing to do here */ if (!$this->initially_was_account){ return; @@ -108,8 +101,9 @@ class phpgwAccount extends plugin /* Save to LDAP */ function save() { - plugin::save(); - if ($this->parent != NULL){ + if(chkacl($this->acl,"phpgwAccount") == ""){ + plugin::save(); + /* Write back to ldap */ $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); @@ -124,9 +118,8 @@ class phpgwAccount extends plugin } else { $this->handle_post_events("add"); } - } + } } - } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/plugins/personal/connectivity/class_phpscheduleitAccount.inc b/plugins/personal/connectivity/class_phpscheduleitAccount.inc index 210f07bf6..775773261 100644 --- a/plugins/personal/connectivity/class_phpscheduleitAccount.inc +++ b/plugins/personal/connectivity/class_phpscheduleitAccount.inc @@ -59,10 +59,6 @@ class phpscheduleitAccount extends plugin $smarty->assign("wstate", "disabled"); } - if ($this->parent != NULL){ - $smarty->assign("tabbed", 1); - } - $smarty->assign('gosaphpscheduleitACL', chkacl($this->acl, 'gosaphpscheduleit')); $display.= $smarty->fetch (get_template_path('phpscheduleit.tpl', TRUE, dirname(__FILE__))); diff --git a/plugins/personal/connectivity/class_pptpAccount.inc b/plugins/personal/connectivity/class_pptpAccount.inc index 858f42a79..6e1076dac 100644 --- a/plugins/personal/connectivity/class_pptpAccount.inc +++ b/plugins/personal/connectivity/class_pptpAccount.inc @@ -58,10 +58,6 @@ class pptpAccount extends plugin $smarty->assign("wstate", "disabled"); } - if ($this->parent != NULL){ - $smarty->assign("tabbed", 1); - } - $smarty->assign('gosapptpACL', chkacl($this->acl, 'gosapptp')); $display.= $smarty->fetch (get_template_path('pptp.tpl', TRUE, dirname(__FILE__))); @@ -70,22 +66,24 @@ class pptpAccount extends plugin function remove_from_parent() { - /* Cancel if there's nothing to do here */ - if (!$this->initially_was_account){ - return; - } + if(chkacl($this->acl, 'gosapptp') == ""){ + /* Cancel if there's nothing to do here */ + if (!$this->initially_was_account){ + return; + } - plugin::remove_from_parent(); - $ldap= $this->config->get_ldap_link(); + plugin::remove_from_parent(); + $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, - $this->attributes, "Save"); - $ldap->modify($this->attrs); - show_ldap_error($ldap->get_error()); + $ldap->cd($this->dn); + @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, + $this->attributes, "Save"); + $ldap->modify($this->attrs); + show_ldap_error($ldap->get_error()); - /* Optionally execute a command after we're done */ - $this->handle_post_events('remove'); + /* Optionally execute a command after we're done */ + $this->handle_post_events('remove'); + } } @@ -115,23 +113,24 @@ class pptpAccount extends plugin /* Save to LDAP */ function save() { - plugin::save(); - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - show_ldap_error($ldap->get_error()); - - /* Optionally execute a command after we're done */ - if ($this->initially_was_account == $this->is_account){ - if ($this->is_modified){ - $this->handle_post_events("mofify"); + if(chkacl($this->acl, 'gosapptp') == ""){ + plugin::save(); + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $ldap->modify($this->attrs); + show_ldap_error($ldap->get_error()); + + /* Optionally execute a command after we're done */ + if ($this->initially_was_account == $this->is_account){ + if ($this->is_modified){ + $this->handle_post_events("mofify"); + } + } else { + $this->handle_post_events("add"); } - } else { - $this->handle_post_events("add"); } - } } diff --git a/plugins/personal/connectivity/class_proxyAccount.inc b/plugins/personal/connectivity/class_proxyAccount.inc index 5ff004cde..036798990 100644 --- a/plugins/personal/connectivity/class_proxyAccount.inc +++ b/plugins/personal/connectivity/class_proxyAccount.inc @@ -37,6 +37,7 @@ class proxyAccount extends plugin /* Prepare templating */ $smarty= get_smarty(); + $smarty->assign("proxyAccountACL", chkacl($this->acl, "proxyAccount")); $smarty->assign("gosaProxyAcctFlagsACL", chkacl($this->acl, "gosaProxyAcctFlags")); $smarty->assign("gosaProxyWorkingStartACL", chkacl($this->acl, "gosaProxyWorkingStart")); $smarty->assign("gosaProxyWorkingStopACL", chkacl($this->acl, "gosaProxyWorkingStop")); @@ -96,6 +97,44 @@ class proxyAccount extends plugin $smarty->assign("pstate", ""); } + $changeA = ""; + + if(chkacl($this->acl,"gosaProxyAcctFlags")==""){ + $changeA .="changeState('filterF');\n"; + } + $smarty->assign("Working_allowedACL","disabled"); + if((chkacl($this->acl,"gosaProxyWorkingStart")=="")||(chkacl($this->acl,"gosaProxyWorkingStop")=="")){ + $smarty->assign("Working_allowedACL",""); + $changeA .= "changeState('filterT');\n"; + } + + $ProxyWorkingStateChange =""; + if(chkacl($this->acl,"gosaProxyWorkingStart")==""){ + $ProxyWorkingStateChange.= "changeState('startHour');\n"; + $ProxyWorkingStateChange.= "changeState('startMinute');\n"; + } + + if(chkacl($this->acl,"gosaProxyWorkingStop")=="") { + $ProxyWorkingStateChange.= "changeState('stopHour');\n"; + $ProxyWorkingStateChange.= "changeState('stopMinute');\n"; + } + + $changeA .= $ProxyWorkingStateChange; + + $smarty->assign("ProxyWorkingStateChange",$ProxyWorkingStateChange); + + $changeB = ""; + if(chkacl($this->acl,"gosaProxyQuota")==""){ + $changeA .= "changeState('filterB');"; + $changeB = + "changeSubselectState('filterB', 'quota_size'); + changeSubselectState('filterB', 'quota_unit'); + changeSubselectState('filterB', 'gosaProxyQuotaPeriod');"; + } + + $smarty->assign("changeB",$changeB); + $smarty->assign("changeA",$changeA); + /* Show main page */ $display.= $smarty->fetch(get_template_path('proxy.tpl', TRUE, dirname(__FILE__))); return($display); @@ -173,10 +212,13 @@ class proxyAccount extends plugin } /* Save time values */ - if (chkacl ($this->acl, "gosaProxyWorkingTime") == "" && isset($_POST['startMinute'])){ + if ((chkacl ($this->acl, "gosaProxyWorkingStart") == "")&&(isset($_POST['startMinute']))){ $old= $this->gosaProxyWorkingStart; $this->gosaProxyWorkingStart= $_POST["startHour"] * 60 + $_POST["startMinute"]; $this->is_modified= ($old != $this->gosaProxyWorkingStart)?TRUE:$this->is_modified; + } + + if ((chkacl ($this->acl, "gosaProxyWorkingStop") == "")&&(isset($_POST['stopMinute']))){ $old= $this->gosaProxyWorkingStop; $this->gosaProxyWorkingStop = $_POST["stopHour"] * 60 + $_POST["stopMinute"]; $this->is_modified= ($old != $this->gosaProxyWorkingStop)?TRUE:$this->is_modified; diff --git a/plugins/personal/connectivity/class_pureftpdAccount.inc b/plugins/personal/connectivity/class_pureftpdAccount.inc index 66dc9faa6..ee36f2ae0 100644 --- a/plugins/personal/connectivity/class_pureftpdAccount.inc +++ b/plugins/personal/connectivity/class_pureftpdAccount.inc @@ -57,15 +57,16 @@ class pureftpdAccount extends plugin } $smarty->assign("use_FTPStatus", ($this->FTPStatus == "disabled") ? "checked" : ""); - # Hickert, Added Else. Smarty have to know the variable in both cases - if ($this->parent != NULL){ - $smarty->assign("tabbed", 1); - }else { - $smarty->assign("tabbed", 0); - } - $smarty->assign("pureftpdACL", chkacl($this->acl, 'pureftpd')); + $changeState = ""; + foreach($this->attributes as $attr){ + $smarty->assign($attr."ACL",chkacl($this->acl,$attr)); + if(chkacl($this->acl,$attr)==""){ + $changeState .= "changeState('".$attr."');\n"; + } + } + $smarty->assign("changeState",$changeState); $display.= $smarty->fetch (get_template_path('pureftpd.tpl', TRUE, dirname(__FILE__))); return ($display); } @@ -124,19 +125,19 @@ class pureftpdAccount extends plugin /* Check for positive integer values */ if ($this->is_account){ - if (!is_id($this->FTPUploadBandwidth)){ + if ((!is_id($this->FTPUploadBandwidth))&&(chkacl($this->acl,"FTPUploadBandwidth")=="")){ $message[]= _("Value specified as 'Upload bandwidth' is not valid."); } - if (!is_id($this->FTPDownloadBandwidth)){ + if ((!is_id($this->FTPDownloadBandwidth))&&(chkacl($this->acl,"FTPDownloadBandwidth")=="")){ $message[]= _("Value specified as 'Download bandwidth' is not valid."); } - if (!is_id($this->FTPQuotaFiles)){ + if ((!is_id($this->FTPQuotaFiles))&&(chkacl($this->acl,"FTPQuotaFiles")=="")){ $message[]= _("Value specified as 'Files' is not valid."); } - if (!is_id($this->FTPQuotaMBytes)){ + if ((!is_id($this->FTPQuotaMBytes))&&(chkacl($this->acl,"FTPQuotaMBytes")=="")){ $message[]= _("Value specified as 'Size' is not valid."); } - if (!is_id($this->FTPUploadRatio) || !is_id($this->FTPDownloadRatio)){ + if ((!is_id($this->FTPUploadRatio) || !is_id($this->FTPDownloadRatio))&&(chkacl($this->acl,"FTPUploadRatio")=="")&&(chkacl($this->acl,"FTPDownloadRatio")=="")){ $message[]= _("Value specified as 'Ratio' is not valid."); } } @@ -150,6 +151,12 @@ class pureftpdAccount extends plugin { plugin::save(); + foreach($this->attributes as $attr){ + if(chkacl($this->acl,$attr)!=""){ + unset($this->attrs[$attr]); + } + } + /* Write back to ldap */ $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); diff --git a/plugins/personal/connectivity/class_webdavAccount.inc b/plugins/personal/connectivity/class_webdavAccount.inc index 0f4bf36bb..c917e2bd6 100644 --- a/plugins/personal/connectivity/class_webdavAccount.inc +++ b/plugins/personal/connectivity/class_webdavAccount.inc @@ -42,7 +42,7 @@ class webdavAccount extends plugin $smarty->assign("tabbed", 1); } - $smarty->assign('gosaWebdavACL', chkacl($this->acl, 'gosaWebdav')); + $smarty->assign('webdavAccountACL', chkacl($this->acl, 'webdavAccount')); $display.= $smarty->fetch (get_template_path('webdav.tpl', TRUE, dirname(__FILE__))); return ($display); @@ -50,22 +50,24 @@ class webdavAccount extends plugin function remove_from_parent() { - /* Cancel if there's nothing to do here */ - if (!$this->initially_was_account){ - return; - } + if(chkacl($this->acl,"webdavAccount")==""){ + /* Cancel if there's nothing to do here */ + if (!$this->initially_was_account){ + return; + } - plugin::remove_from_parent(); - $ldap= $this->config->get_ldap_link(); + plugin::remove_from_parent(); + $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, - $this->attributes, "Save"); - $ldap->modify($this->attrs); - show_ldap_error($ldap->get_error()); + $ldap->cd($this->dn); + @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, + $this->attributes, "Save"); + $ldap->modify($this->attrs); + show_ldap_error($ldap->get_error()); - /* Optionally execute a command after we're done */ - $this->handle_post_events('remove'); + /* Optionally execute a command after we're done */ + $this->handle_post_events('remove'); + } } @@ -95,23 +97,24 @@ class webdavAccount extends plugin /* Save to LDAP */ function save() { - plugin::save(); - - /* Write back to ldap */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $ldap->modify($this->attrs); - show_ldap_error($ldap->get_error()); - - /* Optionally execute a command after we're done */ - if ($this->initially_was_account == $this->is_account){ - if ($this->is_modified){ - $this->handle_post_events("mofify"); + if(chkacl($this->acl,"webdavAccount")==""){ + plugin::save(); + + /* Write back to ldap */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $ldap->modify($this->attrs); + show_ldap_error($ldap->get_error()); + + /* Optionally execute a command after we're done */ + if ($this->initially_was_account == $this->is_account){ + if ($this->is_modified){ + $this->handle_post_events("mofify"); + } + } else { + $this->handle_post_events("add"); } - } else { - $this->handle_post_events("add"); } - } } diff --git a/plugins/personal/connectivity/intranet.tpl b/plugins/personal/connectivity/intranet.tpl index 4c119cb61..f768285fe 100644 --- a/plugins/personal/connectivity/intranet.tpl +++ b/plugins/personal/connectivity/intranet.tpl @@ -1 +1,4 @@ -

{if $tabbed eq 1}{/if}{t}Intranet account{/t}

+

+ + {t}Intranet account{/t} +

diff --git a/plugins/personal/connectivity/phpgw.tpl b/plugins/personal/connectivity/phpgw.tpl index a4913d125..299da6716 100644 --- a/plugins/personal/connectivity/phpgw.tpl +++ b/plugins/personal/connectivity/phpgw.tpl @@ -1 +1,4 @@ -

{if $tabbed eq 1}{/if}{t}PHPGroupware account{/t}

+

+ + {t}PHPGroupware account{/t} +

diff --git a/plugins/personal/connectivity/phpscheduleit.tpl b/plugins/personal/connectivity/phpscheduleit.tpl index f3ca92638..7e5510c3f 100644 --- a/plugins/personal/connectivity/phpscheduleit.tpl +++ b/plugins/personal/connectivity/phpscheduleit.tpl @@ -1 +1,4 @@ -

{if $tabbed eq 1}{/if}{t}PHPscheduleit account{/t}

+

+ + {t}PHPscheduleit account{/t} +

diff --git a/plugins/personal/connectivity/pptp.tpl b/plugins/personal/connectivity/pptp.tpl index 961d23fa4..15d28a792 100644 --- a/plugins/personal/connectivity/pptp.tpl +++ b/plugins/personal/connectivity/pptp.tpl @@ -1 +1,4 @@ -

{if $tabbed eq 1}{/if}{t}PPTP account{/t}

+

+ + {t}PPTP account{/t} +

diff --git a/plugins/personal/connectivity/proxy.tpl b/plugins/personal/connectivity/proxy.tpl index adaa5100b..4cfc13e84 100644 --- a/plugins/personal/connectivity/proxy.tpl +++ b/plugins/personal/connectivity/proxy.tpl @@ -1,19 +1,12 @@

- {if $tabbed eq 1} - - {/if}{t}Proxy account{/t}

+ {t}Proxy account{/t} @@ -25,13 +18,8 @@
- +
@@ -60,12 +48,8 @@  
- +
diff --git a/plugins/personal/connectivity/pureftpd.tpl b/plugins/personal/connectivity/pureftpd.tpl index cb6557ed1..2dc1ca313 100644 --- a/plugins/personal/connectivity/pureftpd.tpl +++ b/plugins/personal/connectivity/pureftpd.tpl @@ -1,4 +1,8 @@ -

{if $tabbed eq 1}{/if}{t}FTP account{/t}

+

+ + {t}FTP account{/t} +

diff --git a/plugins/personal/connectivity/webdav.tpl b/plugins/personal/connectivity/webdav.tpl index 14fbf3fe9..ecd567cd3 100644 --- a/plugins/personal/connectivity/webdav.tpl +++ b/plugins/personal/connectivity/webdav.tpl @@ -1 +1,4 @@ -

{if $tabbed eq 1}{/if}{t}WebDAV account{/t}

+

+ + {t}WebDAV account{/t} +

-- 2.30.2