From: hickert Date: Mon, 4 Dec 2006 10:41:49 +0000 (+0000) Subject: Fixed Variable && Template acl settings X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=06274eafa392f0d74e0a3ae5cab995fe251a1631;p=gosa.git Fixed Variable && Template acl settings git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5297 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_faiTemplate.inc b/plugins/admin/fai/class_faiTemplate.inc index 0c4fa51df..968561d7e 100644 --- a/plugins/admin/fai/class_faiTemplate.inc +++ b/plugins/admin/fai/class_faiTemplate.inc @@ -67,6 +67,14 @@ class faiTemplate extends plugin $ldap->search("(&(objectClass=FAIclass)(objectClass=".$this->subClass."))",$attrs_to_search); while($object = $ldap->fetch()){ + + /* Skip objects, that are tagged as removed */ + if(isset($object['FAIstate'][0])){ + if(preg_match("/removed$/",$object['FAIstate'][0])){ + continue; + } + } + /* Set status for save management */ $objects = array(); $objects['status'] = "FreshLoaded"; @@ -246,8 +254,13 @@ class faiTemplate extends plugin $tmp = $this->getList(true); + /* Create div list with all sub entries listed */ foreach($this->SubObjects as $key => $name){ + /* Skip removed entries */ + if($name['status'] == "delete") continue; + + /* Get permissions */ $dn = $this->acl_base_for_current_object($name['dn']); $acl = $this->ui->get_permissions($dn,"fai/faiTemplateEntry") ; $act = ""; diff --git a/plugins/admin/fai/class_faiTemplateEntry.inc b/plugins/admin/fai/class_faiTemplateEntry.inc index b2a70eec4..7a3c48ddf 100644 --- a/plugins/admin/fai/class_faiTemplateEntry.inc +++ b/plugins/admin/fai/class_faiTemplateEntry.inc @@ -144,40 +144,40 @@ class faiTemplateEntry extends plugin /* Save data to object */ function save_object() { - if (!isset($_POST['FAItemplatePath'])){ - return; - } + /* Check if form is posted and we are not freezed */ if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){ - foreach($this->attributes as $attrs){ - if($attrs == "FAItemplateFile") - continue; - if($attrs == "FAIowner") { - $this->$attrs = $_POST["user"] . '.' . $_POST["group"]; - continue; - } - if(isset($_POST[$attrs])){ - $this->$attrs = $_POST[$attrs]; - }else{ - $this->$attrs = ""; - } + + plugin::save_object(); + + /* Set user.group (FAIowner) attribute */ + if(isset($_POST['group']) && isset($_POST["user"]) && $this->acl_is_writeable("FAIowner")){ + $this->FAIowner = $_POST["user"].'.'.$_POST["group"]; + $this->user = $_POST['user']; + $this->group= $_POST['group']; } - /* Save mode */ - $tmode= ""; - foreach (array("s", "u", "g", "o") as $type){ - $nr= 1; - $dest= 0; - while ($nr < 5){ - if (isset($_POST["$type$nr"])){ - $dest+= $nr; + + /* Check if permissions have changed */ + if($this->acl_is_writeable("FAImode")){ + + /* Save mode */ + $tmode= ""; + foreach (array("s", "u", "g", "o") as $type){ + $nr= 1; + $dest= 0; + while ($nr < 5){ + if (isset($_POST["$type$nr"])){ + $dest+= $nr; + } + $nr+= $nr; } - $nr+= $nr; + $tmode= $tmode.$dest; } - $tmode= $tmode.$dest; + $this->FAImode= $tmode; } - $this->FAImode= $tmode; } } + /* Check supplied data */ function check() { diff --git a/plugins/admin/fai/class_faiVariable.inc b/plugins/admin/fai/class_faiVariable.inc index 12f21d978..60baec911 100644 --- a/plugins/admin/fai/class_faiVariable.inc +++ b/plugins/admin/fai/class_faiVariable.inc @@ -210,21 +210,17 @@ class faiVariable extends plugin $ret = $this->getList(); $tmp = array(); foreach($this->SubObjects as $key => $obj){ - $acl = $ui->get_permissions($obj['dn'],"fai/faiVariableEntry"); - if(preg_match("/r/",$acl)){ $tmp[$key] = $ret[$key]; } - - $smarty->assign("SubObjects",$tmp); } + $smarty->assign("SubObjects",$tmp); - /* Magic quotes GPC, escapes every ' " \, to solve some security risks + /* Magic quotes GPC, escapes every ' " \, to solve some security risks * If we post the escaped strings they will be escaped again */ - foreach($this->attributes as $attrs){ if(get_magic_quotes_gpc()){ $smarty->assign($attrs,htmlentities (stripslashes(utf8_decode($this->$attrs)))); diff --git a/plugins/admin/fai/faiTemplateEntry.tpl b/plugins/admin/fai/faiTemplateEntry.tpl index a047f7a26..c431ab52a 100644 --- a/plugins/admin/fai/faiTemplateEntry.tpl +++ b/plugins/admin/fai/faiTemplateEntry.tpl @@ -75,7 +75,7 @@ -{render acl=$userACL} +{render acl=$FAIownerACL} {/render} @@ -86,7 +86,7 @@ -{render acl=$groupACL} +{render acl=$FAIownerACL} {/render}
@@ -108,51 +108,51 @@   {t}User{/t} -{render acl=$userACL} +{render acl=$FAImodeACL} {/render} -{render acl=$userACL} +{render acl=$FAImodeACL} {/render} -{render acl=$userACL} +{render acl=$FAImodeACL} {/render}   -{render acl=$userACL} +{render acl=$FAImodeACL} {/render} ({t}SUID{/t}) {t}Group{/t} -{render acl=$userACL} +{render acl=$FAImodeACL} {/render} -{render acl=$userACL} +{render acl=$FAImodeACL} {/render} -{render acl=$userACL} +{render acl=$FAImodeACL} {/render}   -{render acl=$userACL} +{render acl=$FAImodeACL} {/render} ({t}SGID{/t}) {t}Others{/t} -{render acl=$userACL} +{render acl=$FAImodeACL} {/render} -{render acl=$userACL} +{render acl=$FAImodeACL} {/render} -{render acl=$userACL} +{render acl=$FAImodeACL} {/render}   -{render acl=$userACL} +{render acl=$FAImodeACL} {/render} ({t}sticky{/t}) @@ -173,6 +173,9 @@ + + +