X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_acl.inc;h=6aadfc637d5fb8258854dfaa1f4f0a9e091e630e;hb=4ea9e915f0fafd23fe70c0221ea174691a25c71f;hp=6f88cec17bb49c05fb953a02510db9602a6d2a01;hpb=0985eccc1c68ba0e76b81b1e9c36ffb54dd227e1;p=gosa.git
diff --git a/gosa-core/include/class_acl.inc b/gosa-core/include/class_acl.inc
index 6f88cec17..6aadfc637 100644
--- a/gosa-core/include/class_acl.inc
+++ b/gosa-core/include/class_acl.inc
@@ -39,6 +39,7 @@ class acl extends plugin
var $target= "group";
var $aclTypes= array();
var $aclObjects= array();
+ var $aclFilter= "";
var $aclMyObjects= array();
var $users= array();
var $roles= array();
@@ -91,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])){
@@ -159,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 {
@@ -225,7 +227,7 @@ class acl extends plugin
{
/* Call parent execute */
plugin::execute();
-
+
$tmp= session::get('plist');
$plist= $tmp->info;
@@ -320,25 +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){
- unset($this->aclContents[$oc]);
- unset($this->aclContents[$this->aclObject.'/'.$oc]);
- if (isset($new_acl[$oc])){
- $this->aclContents[$oc]= $new_acl[$oc];
- }
- if (isset($new_acl[$this->aclObject.'/'.$oc])){
- $this->aclContents[$this->aclObject.'/'.$oc]= $new_acl[$this->aclObject.'/'.$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])){
+
+ 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];
+ }
}
}
- }
- /* 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? */
@@ -355,6 +365,7 @@ class acl extends plugin
$this->gosaAclEntry[$this->currentIndex]['type']= $this->aclType;
$this->gosaAclEntry[$this->currentIndex]['members']= $this->recipients;
$this->gosaAclEntry[$this->currentIndex]['acl']= $this->aclContents;
+ $this->gosaAclEntry[$this->currentIndex]['filter']= $this->aclFilter;
$this->dialogState= 'head';
$this->dialog= FALSE;
}
@@ -406,9 +417,11 @@ class acl extends plugin
}
/* Save common values */
- foreach (array("aclType", "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]);
+ }
}
}
@@ -422,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));
@@ -477,6 +501,7 @@ class acl extends plugin
$smarty->assign("aclList", $aclList->DrawList());
$smarty->assign("aclType", $this->aclType);
+ $smarty->assign("aclFilter", $this->aclFilter);
$smarty->assign("aclTypes", $this->aclTypes);
$smarty->assign("target", $this->target);
$smarty->assign("targets", $this->targets);
@@ -538,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')));
}
@@ -609,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);
@@ -686,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;
@@ -713,7 +746,7 @@ class acl extends plugin
/* Walk through the list of attributes */
$cnt= 1;
$splist= $plist[preg_replace('%^.*/%', '', $key)]['plProvidedAcls'];
- asort($splist);
+# asort($splist);
if(session::get('js')) {
if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) {
$display.= "\n