From fca2f1e1778537f025ce80b0b714753918c3d323 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 20 Oct 2008 07:44:12 +0000 Subject: [PATCH] Updated class ACL, it uses ACLs now. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12736 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_acl.inc | 182 ++++++++++++++++++-------------- 1 file changed, 100 insertions(+), 82 deletions(-) diff --git a/gosa-core/include/class_acl.inc b/gosa-core/include/class_acl.inc index e7ff5d079..9e1279498 100644 --- a/gosa-core/include/class_acl.inc +++ b/gosa-core/include/class_acl.inc @@ -243,88 +243,92 @@ class acl extends plugin $aclDialog= FALSE; $firstedit= FALSE; - /* Only handle posts, if we allowed to modify ACLs - */ - if($this->acl_is_writeable("")){ - foreach($_POST as $name => $post){ - - /* Actions... */ - if (preg_match('/^acl_edit_.*_x/', $name)){ - $this->dialogState= 'create'; - $firstedit= TRUE; - $this->dialog= TRUE; - $this->currentIndex= preg_replace('/^acl_edit_([0-9]+).*$/', '\1', $name); - $this->loadAclEntry(); - continue; - } - if (preg_match('/^acl_del_.*_x/', $name)){ - unset($this->gosaAclEntry[preg_replace('/^acl_del_([0-9]+).*$/', '\1', $name)]); - continue; - } + foreach($_POST as $name => $post){ + + /* Actions... */ + if (preg_match('/^acl_edit_.*_x/', $name)){ + $this->dialogState= 'create'; + $firstedit= TRUE; + $this->dialog= TRUE; + $this->currentIndex= preg_replace('/^acl_edit_([0-9]+).*$/', '\1', $name); + $this->loadAclEntry(); + continue; + } - if (preg_match('/^cat_edit_.*_x/', $name)){ - $this->aclObject= preg_replace('/^cat_edit_([^_]+)_.*$/', '\1', $name); - $this->dialogState= 'edit'; - foreach ($this->ocMapping[$this->aclObject] as $oc){ - if (isset($this->aclContents[$oc])){ - $this->savedAclContents[$oc]= $this->aclContents[$oc]; - } + if (preg_match('/^cat_edit_.*_x/', $name)){ + $this->aclObject= preg_replace('/^cat_edit_([^_]+)_.*$/', '\1', $name); + $this->dialogState= 'edit'; + foreach ($this->ocMapping[$this->aclObject] as $oc){ + if (isset($this->aclContents[$oc])){ + $this->savedAclContents[$oc]= $this->aclContents[$oc]; } - continue; } - if (preg_match('/^cat_del_.*_x/', $name)){ - $idx= preg_replace('/^cat_del_([^_]+)_.*$/', '\1', $name); - foreach ($this->ocMapping[$idx] as $key){ - unset($this->aclContents["$idx/$key"]); - } - continue; + continue; + } + + /* Only handle posts, if we allowed to modify ACLs + */ + if(!$this->acl_is_writeable("")){ + continue; + } + + if (preg_match('/^acl_del_.*_x/', $name)){ + unset($this->gosaAclEntry[preg_replace('/^acl_del_([0-9]+).*$/', '\1', $name)]); + continue; + } + + if (preg_match('/^cat_del_.*_x/', $name)){ + $idx= preg_replace('/^cat_del_([^_]+)_.*$/', '\1', $name); + foreach ($this->ocMapping[$idx] as $key){ + unset($this->aclContents["$idx/$key"]); } + continue; + } - /* Sorting... */ - if (preg_match('/^sortup_.*_x/', $name)){ - $index= preg_replace('/^sortup_([0-9]+).*$/', '\1', $name); - if ($index > 0){ - $tmp= $this->gosaAclEntry[$index]; - $this->gosaAclEntry[$index]= $this->gosaAclEntry[$index-1]; - $this->gosaAclEntry[$index-1]= $tmp; - } - continue; + /* Sorting... */ + if (preg_match('/^sortup_.*_x/', $name)){ + $index= preg_replace('/^sortup_([0-9]+).*$/', '\1', $name); + if ($index > 0){ + $tmp= $this->gosaAclEntry[$index]; + $this->gosaAclEntry[$index]= $this->gosaAclEntry[$index-1]; + $this->gosaAclEntry[$index-1]= $tmp; } - if (preg_match('/^sortdown_.*_x/', $name)){ - $index= preg_replace('/^sortdown_([0-9]+).*$/', '\1', $name); - if ($index < count($this->gosaAclEntry)-1){ - $tmp= $this->gosaAclEntry[$index]; - $this->gosaAclEntry[$index]= $this->gosaAclEntry[$index+1]; - $this->gosaAclEntry[$index+1]= $tmp; - } - continue; + continue; + } + if (preg_match('/^sortdown_.*_x/', $name)){ + $index= preg_replace('/^sortdown_([0-9]+).*$/', '\1', $name); + if ($index < count($this->gosaAclEntry)-1){ + $tmp= $this->gosaAclEntry[$index]; + $this->gosaAclEntry[$index]= $this->gosaAclEntry[$index+1]; + $this->gosaAclEntry[$index+1]= $tmp; } + continue; + } - /* ACL saving... */ - if (preg_match('/^acl_.*_[^xy]$/', $name)){ - $aclDialog= TRUE; - list($dummy, $object, $attribute, $value)= split('_', $name); - - /* Skip for detection entry */ - if ($object == 'dummy') { - continue; - } + /* ACL saving... */ + if (preg_match('/^acl_.*_[^xy]$/', $name)){ + $aclDialog= TRUE; + list($dummy, $object, $attribute, $value)= split('_', $name); - /* Ordinary ACLs */ - if (!isset($new_acl[$object])){ - $new_acl[$object]= array(); - } - if (isset($new_acl[$object][$attribute])){ - $new_acl[$object][$attribute].= $value; - } else { - $new_acl[$object][$attribute]= $value; - } + /* Skip for detection entry */ + if ($object == 'dummy') { + continue; } - if(isset($_POST['selected_role'])){ - $this->aclContents = ""; - $this->aclContents = base64_decode($_POST['selected_role']); + /* Ordinary ACLs */ + if (!isset($new_acl[$object])){ + $new_acl[$object]= array(); } + if (isset($new_acl[$object][$attribute])){ + $new_acl[$object][$attribute].= $value; + } else { + $new_acl[$object][$attribute]= $value; + } + } + + if(isset($_POST['selected_role'])){ + $this->aclContents = ""; + $this->aclContents = base64_decode($_POST['selected_role']); } } @@ -448,14 +452,19 @@ class acl extends plugin $field2= array("string" => $this->assembleAclSummary($entry)); if($this->acl_is_writeable("")){ - $action.= ""; - $action.= ""; + $action.= ""; + $action.= ""; + } + + if($this->acl_is_readable("")){ + $action.= ""; } - - $action.= ""; - - if($this->acl_is_removeable()){ - $action.= ""; + if($this->acl_is_removeable("")){ + $action.= ""; } $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px;text-align:right;'"); @@ -496,11 +505,19 @@ class acl extends plugin $summary= sprintf(_("Contains ACLs for these objects: %s"), preg_replace('/, $/', '', $summary)); } + $actions =""; + if($this->acl_is_readable("")){ + $actions= ""; + } + if($this->acl_is_removeable()){ + $actions.= ""; + } + $field1= array("string" => $dsc, "attach" => "style='width:100px'"); $field2= array("string" => $summary); - $action= ""; - $action.= ""; - $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px'"); + $field3= array("string" => $actions, "attach" => "style='border-right:0px;width:50px'"); $aclList->AddEntry(array($field1, $field2, $field3)); } @@ -1187,8 +1204,9 @@ class acl extends plugin "plCategory" => array("acl" => array("description" => _("ACL")." & "._("ACL roles"), "objectClass" => array("gosaAcl","gosaRole"))), "plProvidedAcls"=> array( - "cn" => _("Role name"), - "description" => _("Role description")) +// "cn" => _("Role name"), +// "description" => _("Role description") + ) )); } -- 2.30.2