X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_acl.inc;h=5e4a03e3e1edbb37f685a87a3e734d8efc532e1f;hb=46e5854a4fc9e9ed72276149b64ee8399abdb7d9;hp=c1f24d70728120bf8772753030b8a5f1bd6dbe2d;hpb=63c674664e628f21496bfde29223fac14d0f0443;p=gosa.git diff --git a/gosa-core/include/class_acl.inc b/gosa-core/include/class_acl.inc index c1f24d707..5e4a03e3e 100644 --- a/gosa-core/include/class_acl.inc +++ b/gosa-core/include/class_acl.inc @@ -92,11 +92,11 @@ class acl extends plugin /* Groups */ $ldap->cd($config->current['BASE']); - if ($tag == ""){ +# if ($tag == ""){ $ldap->search('(objectClass=posixGroup)', array('cn', 'description')); - } else { - $ldap->search('(&(objectClass=posixGroup)(gosaUnitTag='.$tag.'))', array('cn', 'description')); - } +# } else { +# $ldap->search('(&(objectClass=posixGroup)(gosaUnitTag='.$tag.'))', array('cn', 'description')); +# } while ($attrs= $ldap->fetch()){ $dsc= ""; if (isset($attrs['description'][0])){ @@ -160,13 +160,14 @@ class acl extends plugin /* Non numeric index means -> base object containing more informations */ if (preg_match('/^[0-9]+$/', $idx)){ + if (!isset($this->ocMapping[$data])){ $this->ocMapping[$data]= array(); $this->ocMapping[$data][]= '0'; } if(isset($cats[$data])){ - $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription']; + $this->myAclObjects[$data.'/'.$class]= $acls['plDescription']; } $this->ocMapping[$data][]= $class; } else { @@ -321,30 +322,33 @@ class acl extends plugin $this->aclContents = base64_decode($_POST['selected_role']); } } - - /* Only be interested in new acl's, if we're in the right _POST place */ - if ($aclDialog && $this->aclObject != "" && is_array($this->ocMapping[$this->aclObject])){ - foreach ($this->ocMapping[$this->aclObject] as $oc){ + if($this->acl_is_writeable("")){ + + /* Only be interested in new acl's, if we're in the right _POST place */ + if ($aclDialog && $this->aclObject != "" && is_array($this->ocMapping[$this->aclObject])){ - if(isset($this->aclContents[$oc]) && is_array($this->aclContents)){ - unset($this->aclContents[$oc]); - unset($this->aclContents[$this->aclObject.'/'.$oc]); - }else{ + foreach ($this->ocMapping[$this->aclObject] as $oc){ + + if(isset($this->aclContents[$oc]) && is_array($this->aclContents)){ + unset($this->aclContents[$oc]); + unset($this->aclContents[$this->aclObject.'/'.$oc]); + }else{ # trigger_error("Huhm?"); - } - if (isset($new_acl[$oc]) && is_array($new_acl)){ - $this->aclContents[$oc]= $new_acl[$oc]; - } - if (isset($new_acl[$this->aclObject.'/'.$oc]) && is_array($new_acl)){ - $this->aclContents[$this->aclObject.'/'.$oc]= $new_acl[$this->aclObject.'/'.$oc]; + } + if (isset($new_acl[$oc]) && is_array($new_acl)){ + $this->aclContents[$oc]= $new_acl[$oc]; + } + if (isset($new_acl[$this->aclObject.'/'.$oc]) && is_array($new_acl)){ + $this->aclContents[$this->aclObject.'/'.$oc]= $new_acl[$this->aclObject.'/'.$oc]; + } } } - } - /* Save new acl in case of base edit mode */ - if ($this->aclType == 'base' && !$firstedit){ - $this->aclContents= $new_acl; + /* Save new acl in case of base edit mode */ + if ($this->aclType == 'base' && !$firstedit){ + $this->aclContents= $new_acl; + } } /* Cancel new acl? */ @@ -413,9 +417,11 @@ class acl extends plugin } /* Save common values */ - foreach (array("aclType","aclFilter", "aclObject", "target") as $key){ - if (isset($_POST[$key])){ - $this->$key= validate($_POST[$key]); + if($this->acl_is_writeable("")){ + foreach (array("aclType","aclFilter", "aclObject", "target") as $key){ + if (isset($_POST[$key])){ + $this->$key= validate($_POST[$key]); + } } } @@ -429,12 +435,23 @@ class acl extends plugin /* Fill in entries */ foreach ($this->gosaAclEntry as $key => $entry){ + if(!$this->acl_is_readable("")) continue; + + $action =""; + $field1= array("string" => $this->aclTypes[$entry['type']], "attach" => "style='width:150px'"); $field2= array("string" => $this->assembleAclSummary($entry)); - $action= ""; - $action.= ""; + + if($this->acl_is_writeable("")){ + $action.= ""; + $action.= ""; + } + $action.= ""; - $action.= ""; + + if($this->acl_is_removeable()){ + $action.= ""; + } $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px;text-align:right;'"); $aclList->AddEntry(array($field1, $field2, $field3)); @@ -546,6 +563,12 @@ class acl extends plugin /* Show main page */ $smarty->assign("dialogState", $this->dialogState); + + /* Assign acls */ + $smarty->assign("acl_createable",$this->acl_is_createable()); + $smarty->assign("acl_writeable" ,$this->acl_is_writeable("")); + $smarty->assign("acl_readable" ,$this->acl_is_readable("")); + $smarty->assign("acl_removeable",$this->acl_is_removeable()); return ($smarty->fetch (get_template_path('acl.tpl'))); } @@ -617,33 +640,35 @@ class acl extends plugin /* Add select all/none buttons */ $style = "style='width:100px;'"; - $display .= ""; - $display .= ""; - $display .= " - "; - $display .= ""; - $display .= " - "; - - $display .= ""; - $display .= ""; - - $display .= "
"; - - $style = "style='width:50px;'"; - $display .= ""; - $display .= ""; - $display .= ""; - $display .= ""; - $display .= ""; - $display .= " - "; - $display .= ""; - $display .= ""; - $display .= ""; - $display .= " - "; - - $display .= ""; - $display .= ""; - $display .= ""; - $display .= ""; + if($this->acl_is_writeable("")){ + $display .= ""; + $display .= ""; + $display .= " - "; + $display .= ""; + $display .= " - "; + + $display .= ""; + $display .= ""; + + $display .= "
"; + + $style = "style='width:50px;'"; + $display .= ""; + $display .= ""; + $display .= ""; + $display .= ""; + $display .= ""; + $display .= " - "; + $display .= ""; + $display .= ""; + $display .= ""; + $display .= " - "; + + $display .= ""; + $display .= ""; + $display .= ""; + $display .= ""; + } /* Build general objects */ $list =$this->sort_by_priority($list); @@ -694,20 +719,20 @@ class acl extends plugin /* Generate options */ $spc= "  "; - if ($this->isContainer && $this->aclType != 'base'){ +# if ($this->isContainer && $this->aclType != 'base'){ $options= $this->mkchkbx($key."_0_c", _("Create objects"), preg_match('/c/', $overall_acl)).$spc; $options.= $this->mkchkbx($key."_0_m", _("Move objects"), preg_match('/m/', $overall_acl)).$spc; $options.= $this->mkchkbx($key."_0_d", _("Remove objects"), preg_match('/d/', $overall_acl)).$spc; if ($plist[preg_replace('%^.*/%', '', $key)]['plSelfModify']){ $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $overall_acl)).$spc; } - } else { - $options= $this->mkchkbx($key."_0_m", _("Move object"), preg_match('/m/', $overall_acl)).$spc; - $options.= $this->mkchkbx($key."_0_d", _("Remove object"), preg_match('/d/', $overall_acl)).$spc; - if ($plist[preg_replace('%^.*/%', '', $key)]['plSelfModify']){ - $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $overall_acl)).$spc; - } - } + # } else { + # $options= $this->mkchkbx($key."_0_m", _("Move object"), preg_match('/m/', $overall_acl)).$spc; + # $options.= $this->mkchkbx($key."_0_d", _("Remove object"), preg_match('/d/', $overall_acl)).$spc; + # if ($plist[preg_replace('%^.*/%', '', $key)]['plSelfModify']){ + # $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $overall_acl)).$spc; + # } + # } /* Global options */ $more_options= $this->mkchkbx($key."_0_r", _("read"), preg_match('/r/', $overall_acl)).$spc; @@ -791,8 +816,12 @@ class acl extends plugin function mkchkbx($name, $text, $state= FALSE) { $state= $state?"checked":""; - return "\n ". - "\n "; + if($this->acl_is_writeable("")){ + return "\n ". + "\n "; + }else{ + return "\n $text"; + } } @@ -800,10 +829,16 @@ class acl extends plugin { $rstate= preg_match('/r/', $state)?'checked':''; $wstate= preg_match('/w/', $state)?'checked':''; - return ("\n ". - "\n ". - "\n ". - "\n "); + + if($this->acl_is_writeable("")){ + return ("\n ". + "\n ". + "\n ". + "\n "); + }else{ + return ("\n "._("read"). + "\n "._("write")); + } } @@ -1214,6 +1249,7 @@ class acl extends plugin $acl -> save(); } } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: