X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_acl.inc;h=0c3448e09f2a086c79025df542b1aa1eceec9de3;hb=9c309d6fc3d3ff65caf535b6f53ea3177433d29b;hp=fc3f4224aba5b9a4f64ca09ff11edfa2bada9b95;hpb=59a77a5a52ef00081af27f4b053c88c365ce1616;p=gosa.git
diff --git a/gosa-core/include/class_acl.inc b/gosa-core/include/class_acl.inc
index fc3f4224a..0c3448e09 100644
--- a/gosa-core/include/class_acl.inc
+++ b/gosa-core/include/class_acl.inc
@@ -57,6 +57,7 @@ class acl extends plugin
var $list =NULL;
var $sectionList = NULL;
+ var $roleList = NULL;
function acl (&$config, $parent, $dn= NULL)
{
@@ -291,8 +292,11 @@ class acl extends plugin
function convertForListing($entry)
{
$member = implode($entry['members'],", ");
- $acl = implode(array_keys($entry['acl']),", ");
- $type = implode(array_keys($entry['acl']),", ");
+ if(isset($entry['acl']) && is_array($entry['acl'])){
+ $acl = implode(array_keys($entry['acl']),", ");
+ }else{
+ $acl="";
+ }
return(array('data' => array($member, $acl, $this->aclTypes[$entry['type']])));
}
@@ -321,7 +325,7 @@ class acl extends plugin
// Get listing actions. Delete or Edit.
$this->list->save_object();
$lAction = $this->list->getAction();
- $this->gosaAclEntry = $this->list->getMaintainedData();
+ $this->gosaAclEntry = array_values($this->list->getMaintainedData());
/* Act on HTML post and gets here.
*/
@@ -401,6 +405,9 @@ class acl extends plugin
if(isset($_POST['selected_role']) && $_POST['aclType'] == 'role'){
$this->aclContents = "";
$this->aclContents = base64_decode($_POST['selected_role']);
+ }else{
+ if(is_string($this->aclContents))
+ $this->aclContents = array();
}
}
@@ -513,7 +520,7 @@ class acl extends plugin
/* Create templating instance */
$smarty= get_smarty();
- $smarty->assign("usePrototype", "true");
+
$smarty->assign("acl_readable",$this->acl_is_readable(""));
if(!$this->acl_is_readable("")){
return ($smarty->fetch (get_template_path('acl.tpl')));
@@ -526,59 +533,63 @@ class acl extends plugin
if ($this->dialogState == 'create'){
- // Create a map of all used sections, this allows us to simply hide the remove button
- // if no acl is configured for the given section
- // e.g. ';all;department/country;users/user;
- $usedList = ";".implode(array_keys($this->aclContents),';').";";
-
- /* Add settings for all categories to the (permanent) list */
- $data = $lData = array();
- foreach ($this->aclObjects as $section => $dsc){
- $summary= "";
- foreach($this->ocMapping[$section] as $oc){
- if (isset($this->aclContents[$oc]) &&
- count($this->aclContents[$oc]) &&
- isset($this->aclContents[$oc][0]) &&
- $this->aclContents[$oc][0] != ""){
-
- $summary.= "$oc, ";
- continue;
- }
- if (isset($this->aclContents["$section/$oc"]) &&
- count($this->aclContents["$section/$oc"])){
- $summary.= "$oc, ";
- continue;
- }
- if (isset($this->aclContents[$oc]) &&
- !isset($this->aclContents[$oc][0]) &&
- count($this->aclContents[$oc])){
- $summary.= "$oc, ";
+
+ if($this->aclType != 'role'){
+
+ // Create a map of all used sections, this allows us to simply hide the remove button
+ // if no acl is configured for the given section
+ // e.g. ';all;department/country;users/user;
+ $usedList = ";".implode(array_keys($this->aclContents),';').";";
+
+ /* Add settings for all categories to the (permanent) list */
+ $data = $lData = array();
+ foreach ($this->aclObjects as $section => $dsc){
+ $summary= "";
+ foreach($this->ocMapping[$section] as $oc){
+ if (isset($this->aclContents[$oc]) &&
+ count($this->aclContents[$oc]) &&
+ isset($this->aclContents[$oc][0]) &&
+ $this->aclContents[$oc][0] != ""){
+
+ $summary.= "$oc, ";
+ continue;
+ }
+ if (isset($this->aclContents["$section/$oc"]) &&
+ count($this->aclContents["$section/$oc"])){
+ $summary.= "$oc, ";
+ continue;
+ }
+ if (isset($this->aclContents[$oc]) &&
+ !isset($this->aclContents[$oc][0]) &&
+ count($this->aclContents[$oc])){
+ $summary.= "$oc, ";
+ }
}
- }
- /* Set summary... */
- if ($summary == ""){
- $summary= ''._("No ACL settings for this category!").'';
- } else {
- $summary= trim($summary,", ");
- $summary= " ".sprintf(_("Contains ACLs for these objects: %s"), $summary);
- }
+ /* Set summary... */
+ if ($summary == ""){
+ $summary= ''._("No ACL settings for this category!").'';
+ } else {
+ $summary= trim($summary,", ");
+ $summary= " ".sprintf(_("ACLs for: %s"), $summary);
+ }
- $actions ="";
- if($this->acl_is_readable("")){
- $actions.= image('images/lists/edit.png','cat_edit_'.$section,
- msgPool::editButton(_("category ACL")));
+ $actions ="";
+ if($this->acl_is_readable("")){
+ $actions.= image('images/lists/edit.png','cat_edit_'.$section,
+ msgPool::editButton(_("category ACL")));
+ }
+ if($this->acl_is_removeable() && preg_match("/;".$section."(;|\/)/", $usedList)){
+ $actions.= image('images/lists/trash.png','cat_del_'.$section,
+ msgPool::delButton(_("category ACL")));
+ }
+ $data[] = $section;
+ $lData[] = array('data'=>array($dsc, $summary, $actions));
}
- if($this->acl_is_removeable() && preg_match("/;".$section."(;|\/)/", $usedList)){
- $actions.= image('images/lists/trash.png','cat_del_'.$section,
- msgPool::delButton(_("category ACL")));
- }
- $data[] = $section;
- $lData[] = array('data'=>array($dsc, $summary, $actions));
+ $this->sectionList->setListData($data,$lData);
+ $this->sectionList->update();
+ $smarty->assign("aclList", $this->sectionList->render());
}
- $this->sectionList->setListData($data,$lData);
- $this->sectionList->update();
- $smarty->assign("aclList", $this->sectionList->render());
$smarty->assign("aclType", $this->aclType);
$smarty->assign("aclFilter", $this->aclFilter);
@@ -617,13 +628,12 @@ class acl extends plugin
/* Role selector if scope is base */
if ($this->aclType == 'role'){
- $smarty->assign('roleSelector', "Role selector");#, $this->buildRoleSelector($this->myAclObjects));
$smarty->assign('roleSelector', $this->buildRoleSelector($this->roles));
}
}
if ($this->dialogState == 'edit'){
- $smarty->assign('headline', sprintf(_("Edit ACL for '%s' - scope is '%s'"), $this->aclObjects[$this->aclObject], $this->aclTypes[$this->aclType]));
+ $smarty->assign('headline', sprintf(_("Edit ACL for '%s' with scope '%s'"), $this->aclObjects[$this->aclObject], $this->aclTypes[$this->aclType]));
/* Collect objects for selected category */
foreach ($this->ocMapping[$this->aclObject] as $idx => $class){
@@ -701,7 +711,6 @@ class acl extends plugin
$data[] = postEncode($dn);
$lData[] = array('data'=>array($option, $values['cn'], $values['description']));
}
- print_a($list);
$this->roleList->setListData($data,$lData);
$this->roleList->update();
return($this->roleList->render());
@@ -937,9 +946,13 @@ class acl extends plugin
if(count($list) == 5){
list($index, $type,$member,$permission,$filter)= $list;
$filter = base64_decode($filter);
- }else{
+ }elseif(count($list) == 4){
$filter = "";
list($index, $type,$member,$permission)= $list;
+ }else{
+ $permission = "";
+ $filter = "";
+ list($index, $type,$member)= $list;
}
$a= array( $index => array("type" => $type,
@@ -1073,9 +1086,9 @@ class acl extends plugin
if($entry['type'] == "role"){
if(isset($this->roles[$entry['acl']])){
- $summary.= sprintf(_("Role: %s"), $this->roles[$entry['acl']]['cn']);
+ $summary.= sprintf(_("ACL role: %s"), $this->roles[$entry['acl']]['cn']);
}else{
- $summary.= sprintf(_("Role: %s"), ""._("unknown role")."");
+ $summary.= sprintf(_("ACL role: %s"), ""._("unknown ACL role")."");
}
}else{
foreach ($entry['acl'] as $name => $object){
@@ -1119,7 +1132,7 @@ class acl extends plugin
$acl= $this->gosaAclEntry[$this->currentIndex];
$this->aclType= $acl['type'];
$this->recipients= $acl['members'];
- $this->aclContents= $acl['acl'];
+ $this->aclContents= (isset($acl['acl'])) ? $acl['acl'] :"";
$this->aclFilter= $acl['filter'];
}
@@ -1169,8 +1182,9 @@ class acl extends plugin
}
/* ACL's if needed */
+ $final.= ":";
if ($entry['type'] != "reset" && $entry['type'] != "role"){
- $acl= ":";
+ $acl = "";
if (isset($entry['acl'])){
foreach ($entry['acl'] as $object => $contents){
@@ -1203,7 +1217,7 @@ class acl extends plugin
}
$tmp_acl[]= $final;
- }
+ }
/* Call main method */
plugin::save();
@@ -1278,8 +1292,7 @@ class acl extends plugin
"plCategory" => array("acl" => array("description" => _("ACL")." & "._("ACL roles"),
"objectClass" => array("gosaAcl","gosaRole"))),
"plProvidedAcls"=> array(
- "gosaAclEntry" => _("Acl entries")
-// "description" => _("Role description")
+ "gosaAclEntry" => _("ACL Entries")
)
));