diff --git a/include/class_acl.inc b/include/class_acl.inc
index 499fcc8cb2e06eff5977f57efb32a34c0571d8c8..41082b3106b9f17b2e92c18561030ced671d004b 100644 (file)
--- a/include/class_acl.inc
+++ b/include/class_acl.inc
var $wasNewEntry= FALSE;
var $ocMapping= array();
var $savedAclContents= array();
-
+ var $myAclObjects = array();
function acl ($config, $parent, $dn= NULL)
{
/* Objects */
$tmp= get_global('plist');
$plist= $tmp->info;
- if (isset($this->parent)){
+ if (isset($this->parent) && $this->parent != NULL){
$oc= array();
foreach ($this->parent->by_object as $key => $obj){
$oc= array_merge($oc, $obj->objectclasses);
} else {
$oc= $this->attrs['objectClass'];
}
+
+
+ /* Extract available categories from plugin info list */
foreach ($plist as $class => $acls){
- if (isset($acls['plDescription'])){
- /* Only feed categories */
- if (isset($acls['plDepends']['description'])){
- $this->aclObjects[$acls['plDepends']['objectClass']]= $acls['plDepends']['description'];
- }
- /* Additionally filter the classes we're interested in in "self edit" mode */
- if (in_array_ics($acls['plDepends']['objectClass'], $oc)){
- $this->myAclObjects[$class]= $acls['plDescription'];
- }
- }
- }
+ /* Only feed categories */
+ if (isset($acls['plCategory'])){
- /* Add category for all objects */
- asort($this->aclObjects);
+ /* Walk through supplied list and feed only translated categories */
+ foreach($acls['plCategory'] as $idx => $data){
+
+ /* 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';
+ }
+ $this->ocMapping[$data][]= $class;
+ } else {
+ if (!isset($this->ocMapping[$idx])){
+ $this->ocMapping[$idx]= array();
+ $this->ocMapping[$idx][]= '0';
+ }
+ $this->ocMapping[$idx][]= $class;
+ $this->aclObjects[$idx]= $data['description'];
+
+ /* Additionally filter the classes we're interested in in "self edit" mode */
+ if (is_array($data['objectClass'])){
+ foreach($data['objectClass'] as $objectClass){
+ if (in_array_ics($objectClass, $oc)){
+ $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
+ break;
+ }
+ }
+ } else {
+ if (in_array_ics($data['objectClass'], $oc)){
+ $this->myAclObjects[$idx.'/'.$class]= $acls['plDescription'];
+ }
+ }
+ }
- /* Generate mapping object */
- foreach ($plist as $oc => $pl){
- if (isset($pl['plDepends']['objectClass'])){
- $class= $pl['plDepends']['objectClass'];
- if (!isset($this->ocMapping[$class])){
- $this->ocMapping[$class]= array();
- $this->ocMapping[$class][]= '0';
}
- $this->ocMapping[$class][]= $oc;
}
}
+ $this->aclObjects['all']= '* '._("All categories");
+ $this->ocMapping['all']= array('0' => 'all');
+
+ /* Sort categories */
+ asort($this->aclObjects);
/* Fill acl types */
if ($this->isContainer){
"one" => _("One level"),
"base" => _("Current object"),
"sub" => _("Complete subtree"),
- "psub" => _("Complete subtree (permanent)"));
- //"role" => _("Use ACL defined in role"));
+ "psub" => _("Complete subtree (permanent)"),
+ "role" => _("Use ACL defined in role"));
} else {
$this->aclTypes= array("base" => _("Current object"),
"role" => _("Use ACL defined in role"));
$new_acl= array();
$aclDialog= FALSE;
+ $firstedit= FALSE;
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();
if (preg_match('/^cat_del_.*_x/', $name)){
$idx= preg_replace('/^cat_del_([^_]+)_.*$/', '\1', $name);
foreach ($this->ocMapping[$idx] as $key){
- unset($this->aclContents[$key]);
+ unset($this->aclContents["$idx/$key"]);
}
continue;
}
$aclDialog= TRUE;
list($dummy, $object, $attribute, $value)= split('_', $name);
+ /* Skip for detection entry */
+ if ($object == 'dummy') {
+ continue;
+ }
+
/* Ordinary ACLs */
if (!isset($new_acl[$object])){
$new_acl[$object]= array();
}
/* Only be interested in new acl's, if we're in the right _POST place */
- if ($aclDialog && isset($this->ocMapping[$this->aclObject])){
+ 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];
+ }
}
}
/* Save new acl in case of base edit mode */
- if ($this->aclType == 'base'){
+ if ($this->aclType == 'base' && !$firstedit){
$this->aclContents= $new_acl;
}
$action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='acl_edit_$key' title='"._("Edit ACL")."'>";
$action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='acl_del_$key' title='"._("Delete ACL")."'>";
- $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px';text-align:right");
+ $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px;text-align:right;'");
$aclList->AddEntry(array($field1, $field2, $field3));
}
$aclList->SetHeight(150);
/* Add settings for all categories to the (permanent) list */
- foreach ($this->aclObjects as $oc => $dsc){
+ foreach ($this->aclObjects as $section => $dsc){
$summary= "";
- foreach ($plist as $key => $plugin){
- if (isset($plugin['plDepends']['objectClass']) && $plugin['plDepends']['objectClass'] == $oc &&
- isset($this->aclContents[$key])){
- if (count($this->aclContents[$key]) && isset($this->aclContents[$key][0]) &&
- $this->aclContents[$key][0] != ""){
- $summary.= "$key, ";
- continue;
- }
- if (!isset($this->aclContents[$key][0]) && count($this->aclContents[$key])){
- $summary.= "$key, ";
- }
+ 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"]) && isset($this->aclContents["$section/$oc"][0]) &&
+ $this->aclContents["$section/$oc"][0] != ""){
+
+ $summary.= "$oc, ";
+ continue;
+ }
+ if (isset($this->aclContents[$oc]) && !isset($this->aclContents[$oc][0]) && count($this->aclContents[$oc])){
+ $summary.= "$oc, ";
}
}
$field1= array("string" => $dsc, "attach" => "style='width:100px'");
$field2= array("string" => $summary);
- $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='cat_edit_$oc' title='"._("Edit categories ACLs")."'>";
- $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='cat_del_$oc' title='"._("Clear categories ACLs")."'>";
+ $action= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='cat_edit_$section' title='"._("Edit categories ACLs")."'>";
+ $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='cat_del_$section' title='"._("Clear categories ACLs")."'>";
$field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px'");
$aclList->AddEntry(array($field1, $field2, $field3));
}
if ($this->aclType == 'base'){
$smarty->assign('aclSelector', $this->buildAclSelector($this->myAclObjects));
}
+
+ /* Role selector if scope is base */
+ if ($this->aclType == 'role'){
+ $smarty->assign('roleSelector', "Role selector");#, $this->buildRoleSelector($this->myAclObjects));
+ }
}
if ($this->dialogState == 'edit'){
$smarty->assign('headline', sprintf(_("Edit ACL for '%s', scope is '%s'"), $this->aclObjects[$this->aclObject], $this->aclTypes[$this->aclType]));
/* Collect objects for selected category */
- $aclObjects= array();
-
- foreach ($plist as $class => $acls){
- if (isset($acls['plDepends']['objectClass']) && $acls['plDepends']['objectClass'] == $this->aclObject){
- $aclObjects[$class]= $acls['plDescription'];
+ foreach ($this->ocMapping[$this->aclObject] as $idx => $class){
+ if ($idx == 0){
+ continue;
}
+ $aclObjects[$this->aclObject.'/'.$class]= $plist[$class]['plDescription'];
+ }
+ if ($this->aclObject == 'all'){
+ $aclObjects['all']= _("All objects in current subtree");
}
- $smarty->assign('aclSelector', $this->buildAclSelector($aclObjects));
+ /* Role selector if scope is base */
+ if ($this->aclType == 'role'){
+ $smarty->assign('roleSelector', "Role selector");#, $this->buildRoleSelector($this->myAclObjects));
+ } else {
+ $smarty->assign('aclSelector', $this->buildAclSelector($aclObjects));
+ }
}
/* Show main page */
return ($smarty->fetch (get_template_path('acl.tpl')));
}
-
+ function sort_by_priority($list)
+ {
+ $tmp= get_global('plist');
+ $plist= $tmp->info;
+ asort($plist);
+ $newSort = array();
+
+ foreach($list as $name => $translation){
+ $na = preg_replace("/^.*\//","",$name);
+ $prio = 0;
+ if(isset($plist[$na]['plPriority'])){
+ $prio= $plist[$na]['plPriority'] ;
+ }
+
+ $newSort[$name] = $prio;
+ }
+
+ asort($newSort);
+
+ $ret = array();
+ foreach($newSort as $name => $prio){
+ $ret[$name] = $list[$name];
+ }
+ return($ret);
+ }
+
function buildAclSelector($list)
{
- $display= "";
+ $display= "<input type='hidden' name='acl_dummy_0_0_0' value='1'>";
$cols= 3;
$tmp= get_global('plist');
$plist= $tmp->info;
asort($plist);
- /* Generate global options */
-# $key= "global";
-# $display.= "<table style='width:100%;border:1px solid #C04040' cellspacing=0 cellpadding=2><tr><td style='background-color:#D88888;height:1.8em' colspan=$cols><b>"._("All objects of this category")."</b></td></tr>";
-#
-# $spc= " ";
-# if ($this->isContainer && $this->aclType != 'base'){
-# $options= $this->mkchkbx($key."_0_c", _("Create objects"), preg_match('/c/', $currentAcl[0])).$spc;
-# $options.= $this->mkchkbx($key."_0_m", _("Move objects"), preg_match('/m/', $currentAcl[0])).$spc;
-# $options.= $this->mkchkbx($key."_0_d", _("Remove objects"), preg_match('/d/', $currentAcl[0])).$spc;
-# if ($plist[$key]['plSelfModify']){
-# $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $currentAcl[0])).$spc;
-# }
-# } else {
-# $options= $this->mkchkbx($key."_0_m", _("Move object"), preg_match('/m/', $currentAcl[0])).$spc;
-# $options.= $this->mkchkbx($key."_0_d", _("Remove object"), preg_match('/d/', $currentAcl[0])).$spc;
-# if ($plist[$key]['plSelfModify']){
-# $options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $currentAcl[0])).$spc;
-# }
-# }
-#
-# /* Global options */
-# $more_options= $this->mkchkbx($key."_0_r", _("read"), preg_match('/r/', $currentAcl[0])).$spc;
-# $more_options.= $this->mkchkbx($key."_0_w", _("write"), preg_match('/w/', $currentAcl[0]));
-#
-# $display.= "<tr><td style='background-color:#E0E0E0' colspan=".($cols-1).">$options</td><td style='background-color:#D4D4D4'> ".("Complete object:")." $more_options</td></tr></table><br>";
+ /* Add select all/none buttons */
+ $style = "style='width:100px;'";
+
+ $display .= "<input ".$style." type='button' name='toggle_all_create' onClick=\"acl_toggle_all('_0_c$');\" value='Toggle C'>";
+ $display .= "<input ".$style." type='button' name='toggle_all_move' onClick=\"acl_toggle_all('_0_m$');\" value='Toggle M'>";
+ $display .= "<input ".$style." type='button' name='toggle_all_remove' onClick=\"acl_toggle_all('_0_d$');\" value='Toggle D'> - ";
+ $display .= "<input ".$style." type='button' name='toggle_all_read' onClick=\"acl_toggle_all('_0_r$');\" value='Toggle R'>";
+ $display .= "<input ".$style." type='button' name='toggle_all_write' onClick=\"acl_toggle_all('_0_w$');\" value='Toggle W'> - ";
+ $display .= "<input ".$style." type='button' name='toggle_all_sub_read' onClick=\"acl_toggle_all('[^0]_r$');\" value='R+'>";
+ $display .= "<input ".$style." type='button' name='toggle_all_sub_write' onClick=\"acl_toggle_all('[^0]_w$');\" value='W+'>";
+
+ $display .= "<br>";
+
+ $style = "style='width:50px;'";
+ $display .= "<input ".$style." type='button' name='set_true_all_create' onClick=\"acl_set_all('_0_c$',true);\" value='C+'>";
+ $display .= "<input ".$style." type='button' name='set_false_all_create' onClick=\"acl_set_all('_0_c$',false);\" value='C-'>";
+ $display .= "<input ".$style." type='button' name='set_true_all_move' onClick=\"acl_set_all('_0_m$',true);\" value='M+'>";
+ $display .= "<input ".$style." type='button' name='set_false_all_move' onClick=\"acl_set_all('_0_m$',false);\" value='M-'>";
+ $display .= "<input ".$style." type='button' name='set_true_all_remove' onClick=\"acl_set_all('_0_d$',true);\" value='D+'>";
+ $display .= "<input ".$style." type='button' name='set_false_all_remove' onClick=\"acl_set_all('_0_d$',false);\" value='D-'> - ";
+ $display .= "<input ".$style." type='button' name='set_true_all_read' onClick=\"acl_set_all('_0_r$',true);\" value='R+'>";
+ $display .= "<input ".$style." type='button' name='set_false_all_read' onClick=\"acl_set_all('_0_r$',false);\" value='R-'>";
+ $display .= "<input ".$style." type='button' name='set_true_all_write' onClick=\"acl_set_all('_0_w$',true);\" value='W+'>";
+ $display .= "<input ".$style." type='button' name='set_false_all_write' onClick=\"acl_set_all('_0_w$',false);\" value='W-'> - ";
+
+ $display .= "<input ".$style." type='button' name='set_true_all_read' onClick=\"acl_set_all('[^0]_r$',true);\" value='R+'>";
+ $display .= "<input ".$style." type='button' name='set_false_all_read' onClick=\"acl_set_all('[^0]_r$',false);\" value='R-'>";
+ $display .= "<input ".$style." type='button' name='set_true_all_write' onClick=\"acl_set_all('[^0]_w$',true);\" value='W+'>";
+ $display .= "<input ".$style." type='button' name='set_false_all_write' onClick=\"acl_set_all('[^0]_w$',false);\" value='W-'>";
+
/* Build general objects */
+ $list =$this->sort_by_priority($list);
foreach ($list as $key => $name){
/* Create sub acl if it does not exist */
if (!isset($this->aclContents[$key])){
$this->aclContents[$key]= array();
- }
- if (!isset($this->aclContents[$key][0])){
$this->aclContents[$key][0]= '';
}
$currentAcl= $this->aclContents[$key];
/* Object header */
- $display.= "<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2><tr><td style='background-color:#C8C8C8;height:1.8em' colspan=$cols><b>"._("Object").": $name</b></td></tr>";
+ if($_SESSION['js']) {
+ if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) {
+ $display.= "\n<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2>".
+ "\n <tr>".
+ "\n <td style='background-color:#C8C8C8;height:1.8em;' colspan=".($cols-1)."><b>"._("Object").": $name</b></td>".
+ "\n <td align='right' style='background-color:#C8C8C8;height:1.8em;'>".
+ "\n <input type='button' onclick='divtoggle(\"".preg_replace("/[^a-z0-9]/i","_",$name)."\");' value='"._("Show/Hide Advanced Settings")."' /></td>".
+ "\n </tr>";
+ } else if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/ie/i",$_SERVER['HTTP_USER_AGENT'])) {
+ $display.= "\n<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2>".
+ "\n <tr>".
+ "\n <td style='background-color:#C8C8C8;height:1.8em;' colspan=".($cols-1)."><b>"._("Object").": $name</b></td>".
+ "\n <td align='right' style='background-color:#C8C8C8;height:1.8em;'>".
+ "\n <input type='button' onclick='divtoggle(\"".preg_replace("/[^a-z0-9]/i","_",$name)."\");' value='"._("Show/Hide Advanced Settings")."' /></td>".
+ "\n </tr>";
+ } else {
+ $display.= "\n<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2>".
+ "\n <tr>".
+ "\n <td style='background-color:#C8C8C8;height:1.8em;' colspan=$cols><b>"._("Object").": $name</b></td>".
+ "\n </tr>";
+ }
+ } else {
+ $display.= "\n<table style='width:100%;border:1px solid #A0A0A0' cellspacing=0 cellpadding=2>".
+ "\n <tr>".
+ "\n <td style='background-color:#C8C8C8;height:1.8em;' colspan=$cols><b>"._("Object").": $name</b></td>".
+ "\n </tr>";
+ }
/* Generate options */
$spc= " ";
$options= $this->mkchkbx($key."_0_c", _("Create objects"), preg_match('/c/', $currentAcl[0])).$spc;
$options.= $this->mkchkbx($key."_0_m", _("Move objects"), preg_match('/m/', $currentAcl[0])).$spc;
$options.= $this->mkchkbx($key."_0_d", _("Remove objects"), preg_match('/d/', $currentAcl[0])).$spc;
- if ($plist[$key]['plSelfModify']){
+ if ($plist[preg_replace('%^.*/%', '', $key)]['plSelfModify']){
$options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $currentAcl[0])).$spc;
}
} else {
$options= $this->mkchkbx($key."_0_m", _("Move object"), preg_match('/m/', $currentAcl[0])).$spc;
$options.= $this->mkchkbx($key."_0_d", _("Remove object"), preg_match('/d/', $currentAcl[0])).$spc;
- if ($plist[$key]['plSelfModify']){
+ if ($plist[preg_replace('%^.*/%', '', $key)]['plSelfModify']){
$options.= $this->mkchkbx($key."_0_s", _("Modifyable by owner"), preg_match('/s/', $currentAcl[0])).$spc;
}
}
$more_options= $this->mkchkbx($key."_0_r", _("read"), preg_match('/r/', $currentAcl[0])).$spc;
$more_options.= $this->mkchkbx($key."_0_w", _("write"), preg_match('/w/', $currentAcl[0]));
- $display.= "<tr><td style='background-color:#E0E0E0' colspan=".($cols-1).">$options</td><td style='background-color:#D4D4D4'> ".("Complete object:")." $more_options</td></tr>";
+ $display.= "\n <tr>".
+ "\n <td style='background-color:#E0E0E0' colspan=".($cols-1).">$options</td>".
+ "\n <td style='background-color:#D4D4D4'> "._("Complete object").": $more_options</td>".
+ "\n </tr>";
/* Walk through the list of attributes */
$cnt= 1;
- $splist= $plist[$key];
+ $splist= $plist[preg_replace('%^.*/%', '', $key)]['plProvidedAcls'];
asort($splist);
+ if($_SESSION['js']) {
+ if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) {
+ $display.= "\n <tr id='tr_".preg_replace("/[^a-z0-9]/i","_",$name)."' style='vertical-align:top;height:0px;'>".
+ "\n <td colspan=".$cols.">".
+ "\n <div id='".preg_replace("/[^a-z0-9]/i","_",$name)."' style='overflow:hidden;visibility:hidden;height:0px;vertical-align:top;width:100%;'>".
+ "\n <table style='width:100%;'>";
+ } else if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/ie/i",$_SERVER['HTTP_USER_AGENT'])) {
+ $display.= "\n <tr id='tr_".preg_replace("/[^a-z0-9]/i","_",$name)."' style='vertical-align:top;height:0px;'>".
+ "\n <td colspan=".$cols.">".
+ "\n <div id='".preg_replace("/[^a-z0-9]/i","_",$name)."' style='position:absolute;overflow:hidden;visibility:hidden;height:0px;vertical-align:top;width:100%;'>".
+ "\n <table style='width:100%;'>";
+ }
+ }
foreach($splist as $attr => $dsc){
/* Skip pl* attributes, they are internal... */
/* Open table row */
if ($cnt == 1){
- $display.= "<tr>";
+ $display.= "\n <tr>";
}
/* Close table row */
if ($cnt == $cols){
$cnt= 1;
$rb= "";
- $end= "</tr>";
+ $end= "\n </tr>";
} else {
$cnt++;
$rb= "border-right:1px solid #A0A0A0;";
if (isset($currentAcl[$attr])){
$state= $currentAcl[$attr];
}
- $display.= "<td style='border-top:1px solid #A0A0A0;${rb}width:".(int)(100/$cols)."%'><b>$dsc</b> ($attr)<br>".$this->mkrwbx($key."_".$attr, $state)."</td>$end";
+ $display.= "\n <td style='border-top:1px solid #A0A0A0;${rb}width:".(int)(100/$cols)."%'>".
+ "\n <b>$dsc</b> ($attr)<br>".$this->mkrwbx($key."_".$attr, $state)."</td>$end";
}
/* Fill missing td's if needed */
if (--$cnt != $cols && $cnt != 0){
- $display.= str_repeat("<td style='border-top:1px solid #A0A0A0; width:".(int)(100/$cols)."%'> </td>", $cols-$cnt);
+ $display.= str_repeat("\n <td style='border-top:1px solid #A0A0A0; width:".(int)(100/$cols)."%'> </td>", $cols-$cnt);
+ }
+
+ if($_SESSION['js']) {
+ if(isset($_SERVER['HTTP_USER_AGENT']) && (preg_match("/gecko/i",$_SERVER['HTTP_USER_AGENT'])) || (preg_match("/ie/i",$_SERVER['HTTP_USER_AGENT']))) {
+ $display.= "\n </table>".
+ "\n </div>".
+ "\n </td>".
+ "\n </tr>";
+ }
}
- $display.= "</table><br>";
+ $display.= "\n</table><br />\n";
}
return ($display);
function mkchkbx($name, $text, $state= FALSE)
{
$state= $state?"checked":"";
- return "<input id='acl_$name' type=checkbox name='acl_$name' $state><label for='acl_$name'>$text</label>";
+ return "\n <input id='acl_".preg_replace("/[^a-z0-9]/i","_",$name)."' type=checkbox name='acl_$name' $state>".
+ "\n <label for='acl_$name'>$text</label>";
}
{
$rstate= preg_match('/r/', $state)?'checked':'';
$wstate= preg_match('/w/', $state)?'checked':'';
- return ("<input id='acl_${name}_r' type=checkbox name='acl_${name}_r' $rstate><label for='acl_${name}_r'>"._("read")."</label>".
- "<input id='acl_${name}_w' type=checkbox name='acl_${name}_w' $wstate><label for='acl_${name}_w'>"._("write")."</label>");
+ return ("\n <input id='acl_".preg_replace("/[^a-z0-9]/i","_",$name)."_r' type=checkbox name='acl_${name}_r' $rstate>".
+ "\n <label for='acl_${name}_r'>"._("read")."</label>".
+ "\n <input id='acl_".preg_replace("/[^a-z0-9]/i","_",$name)."_w' type=checkbox name='acl_${name}_w' $wstate>".
+ "\n <label for='acl_${name}_w'>"._("write")."</label>");
}
break;
case 'role':
- echo "Role";
+ echo "Role: $acl";
break;
case 'reset':
$ldap->modify ($this->attrs);
show_ldap_error($ldap->get_error(), sprintf(_("Saving ACLs with dn '%s' failed."),$this->dn));
+
+ /* Refresh users ACLs */
+ $ui= get_userinfo();
+ $ui->loadACL();
+ $_SESSION['ui']= $ui;
}