From 7d8a82ecba7197adb53b6b0ab5de7439a3b18d96 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 18 Oct 2006 07:53:04 +0000 Subject: [PATCH] Added acls to fai template entry git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4893 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiTemplate.inc | 7 +- plugins/admin/fai/class_faiTemplateEntry.inc | 16 ++-- plugins/admin/fai/faiTemplateEntry.tpl | 84 +++++++++++++++----- 3 files changed, 78 insertions(+), 29 deletions(-) diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc index dd364ccd1..0c4fa51df 100644 --- a/plugins/admin/fai/class_faiTemplate.inc +++ b/plugins/admin/fai/class_faiTemplate.inc @@ -136,6 +136,9 @@ class faiTemplate extends plugin $obj = $this->get_object_attributes($obj,$this->sub_Load_Later); } $this->dialog= new $this->subClassName($this->config,$this->dn,$obj); + $this->dialog->set_acl_base($this->acl_base); + $this->dialog->set_acl_category("fai"); + $_SESSION['objectinfo'] = $obj['dn']; $this->dialog->parent = &$this; $this->is_dialog=true; @@ -166,6 +169,8 @@ class faiTemplate extends plugin if(preg_match("/c/",$acl)){ $this->dialog= new $this->subClassName($this->config,"new"); + $this->dialog->set_acl_base($this->acl_base); + $this->dialog->set_acl_category("fai"); $this->is_dialog=true; } } @@ -432,7 +437,7 @@ class faiTemplate extends plugin if(empty($obj[$attrs])){ $obj[$attrs] = array(); } - $tmp[$attrs] = stripslashes($obj[$attrs]); + $tmp[$attrs] =($obj[$attrs]); } $tmp['objectClass'] = $this->subClasses; diff --git a/plugins/admin/fai/class_faiTemplateEntry.inc b/plugins/admin/fai/class_faiTemplateEntry.inc index a2e9035df..24bab5d13 100644 --- a/plugins/admin/fai/class_faiTemplateEntry.inc +++ b/plugins/admin/fai/class_faiTemplateEntry.inc @@ -52,9 +52,16 @@ class faiTemplateEntry extends plugin $this->user = explode( '.', $this->FAIowner ); $this->group = $this->user[1]; $this->user = $this->user[0]; + $_SESSION['binary'] = $this->FAItemplateFile; $_SESSION['binarytype'] = 'octet-stream'; $_SESSION['binaryfile'] = basename( $this->FAItemplatePath ); + + if(!empty($this->dn) && $this->dn != "new"){ + $ldap = $this->config->get_ldap_link(); + $_SESSION['binary'] =$ldap->get_attribute($this->dn,"FAItemplateFile"); + $this->FAItemplateFile = $_SESSION['binary']; + } $this->FAImode= sprintf("%0.4s", $this->FAImode)." "; } @@ -70,7 +77,7 @@ class faiTemplateEntry extends plugin $smarty->assign("rand", rand(0, 10000)); $display = ""; - if(isset($_POST['TmpFileUpload'])){ + if(isset($_POST['TmpFileUpload']) && $this->acl_is_writeable("FAItemplateFile")){ if($str=file_get_contents($_FILES['FAItemplateFile']['tmp_name'])){ $this->FAItemplateFile = $str; @@ -90,6 +97,7 @@ class faiTemplateEntry extends plugin $bStatus = false; // Hide download icon on default if(strlen($this->FAItemplateFile)){ + $status= sprintf(_("exists in database (size: %s bytes)"),strlen($this->FAItemplateFile)); $bStatus = true; // Display download icon } @@ -126,11 +134,7 @@ class faiTemplateEntry extends plugin $smarty->assign("FAItemplateFile",""); foreach($this->attributes as $attr){ - if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){ - $smarty->assign($attr."ACL"," disabled "); - }else{ - $smarty->assign($attr."ACL"," "); - } + $smarty->assign($attr."ACL",$this->getacl($attr,preg_match("/freeze/",$this->FAIstate))); } $display.= "

Fix / problen and ensure that size and content are correct if you download this template. Revision > 4582 (gosa-2.5 is already patched)

".$smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE)); diff --git a/plugins/admin/fai/faiTemplateEntry.tpl b/plugins/admin/fai/faiTemplateEntry.tpl index 4656e4964..a047f7a26 100644 --- a/plugins/admin/fai/faiTemplateEntry.tpl +++ b/plugins/admin/fai/faiTemplateEntry.tpl @@ -5,11 +5,15 @@ {t}Name{/t}{$must}  -    +{render acl=$cnACL} +    +{/render} {t}Description{/t}  - +{render acl=$descriptionACL} + +{/render} @@ -32,12 +36,18 @@ {$status} {if $bStatus} - {t}Save template{/t}... + + {t}Save template{/t}... + {/if}

- -   +{render acl=$FAItemplateFileACL} + +{/render} +{render acl=$FAItemplateFileACL} +   +{/render}

@@ -48,7 +58,9 @@ - +{render acl=$FAItemplatePathACL} + +{/render} @@ -63,8 +75,10 @@ - - +{render acl=$userACL} + +{/render} + - +{render acl=$groupACL} + +{/render}

- + {t}Access{/t}{$must}  @@ -92,29 +108,53 @@   {t}User{/t} - - - +{render acl=$userACL} + +{/render} +{render acl=$userACL} + +{/render} +{render acl=$userACL} + +{/render}   - +{render acl=$userACL} + +{/render} ({t}SUID{/t}) {t}Group{/t} - - - +{render acl=$userACL} + +{/render} +{render acl=$userACL} + +{/render} +{render acl=$userACL} + +{/render}   - +{render acl=$userACL} + +{/render} ({t}SGID{/t}) {t}Others{/t} - - - +{render acl=$userACL} + +{/render} +{render acl=$userACL} + +{/render} +{render acl=$userACL} + +{/render}   - +{render acl=$userACL} + +{/render} ({t}sticky{/t}) -- 2.30.2