index ed888806bd93a17cb6fc963f98ed4dd45a7f5d1d..56fe9ae35a6626d23a1953af9f66c9060801248a 100644 (file)
$this->EnableSaveButton (false);
/* Dynamic action col */
$this->EnableSaveButton (false);
/* Dynamic action col */
- $this->action_col_size = 45;
+ $this->action_col_size = 120;
/* set Page header */
$this->AddHeader(array("string"=>" ", "attach"=>"style='width:20px;'"));
/* set Page header */
$this->AddHeader(array("string"=>" ", "attach"=>"style='width:20px;'"));
which are shown in the listbox on top of the listbox
*/
$options= "";
which are shown in the listbox on top of the listbox
*/
$options= "";
+ $Copy_Paste = "";
/* Get all departments within this subtree */
/* Get all departments within this subtree */
+ $ui= get_userinfo();
+ $first = "";
+ $found = FALSE;
$base = $this->config->current['BASE'];
$deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", "acl", $base,
array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
$base = $this->config->current['BASE'];
$deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", "acl", $base,
array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
$ids = $this->config->idepartments;
foreach($deps as $dep){
if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
$ids = $this->config->idepartments;
foreach($deps as $dep){
if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
+
+ /* Keep first base dn in mind, we could need this
+ * info if no valid base was found
+ */
+ if(empty($first)) {
+ $first = $dep['dn'];
+ }
+
$value = $ids[$dep['dn']];
if ($this->selectedBase == $dep['dn']){
$options.= "<option selected='selected' value='".$dep['dn']."'>$value</option>";
$value = $ids[$dep['dn']];
if ($this->selectedBase == $dep['dn']){
$options.= "<option selected='selected' value='".$dep['dn']."'>$value</option>";
}
}
}
}
+ /* The currently used base is not visible with your acl setup.
+ * Set base to first useable base.
+ */
+ if(!$found){
+ $this->selectedBase = $first;
+ }
+
+ /* Allow copy & paste for roles */
+ $acl_all = $ui->has_complete_category_acls($this->selectedBase,"acl");
+ $acl = $ui->get_permissions($this->selectedBase,"acl/acl");
+
+ /* Add default header */
+ $listhead = MultiSelectWindow::get_default_header();
+
/* Get copy & paste icon */
/* Get copy & paste icon */
- $acl = $ui->get_permissions($this->selectedBase,"acl/aclManagement");
-
- /* Create header with selected base */
- $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
- " <input class='center' type='image' src='images/list_root.png' align='middle'
- title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
- " <input class='center' type='image' align='middle' src='images/list_back.png'
- title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
- " <input class='center' type='image' align='middle' src='images/list_home.png'
- title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
- " <input class='center' type='image' src='images/list_reload.png' align='middle'
- title='"._("Reload list")."' name='submit_department' alt='". _("Submit")."'> ".
- " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ";
- $listhead .=
+ $Copy_Paste ="";
+ if(preg_match("/(c.*w|w.*c)/",$acl_all) && $this->parent->CopyPasteHandler){
+ $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon();
+ $addsep = true;
+ }
+
+ /* Add snapshot icons */
+ if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+ $listhead .= $this->get_snapshot_header($this->selectedBase);
+ $add_sep = true;
+ }
+
+ if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"acl/acl"))){
+ $add_sep = true;
+ $listhead .= "<input class='center' type='image' align='middle' src='images/list_new_acl_role.png'
+ name='new_acl_role' alt='"._("New acl role")."' title='"._("New acl role")."'> ";
+ }
+
+ $listhead .= $Copy_Paste.
_("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
" <input class='center' type='image' src='images/list_submit.png' align='middle'
title='"._("Submit department")."' name='submit_department' alt='". _("Submit")."'> ".
_("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
" <input class='center' type='image' src='images/list_submit.png' align='middle'
title='"._("Submit department")."' name='submit_department' alt='". _("Submit")."'> ".
function setEntries($list)
{
function setEntries($list)
{
- $list_left_icon = "<img src='images/select_acl.png' alt='"._("Acl")."'>";
- $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=list_edit_entry'>%s</a>";
foreach($list as $key => $acl_entry){
/* Get copy & paste icon */
foreach($list as $key => $acl_entry){
/* Get copy & paste icon */
- $acl = $this->ui->get_permissions($acl_entry['dn'],"acl/aclManagement");
+ $acl = $this->ui->get_permissions($acl_entry['dn'],"acl/acl");
+ $acl_all = $this->ui->has_complete_category_acls($acl_entry['dn'],"acl");
+ $action = "";
- $action = "";
+ if(in_array("gosaRole",$acl_entry['objectClass'])){
- /* Add actions depending on acls */
- if(preg_match("/r/", $acl)){
- $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'
- name='list_acl_edit_%KEY%' title='"._("Edit system")."'>";
- }
- if(preg_match("/d/", $acl)){
- $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
- name='list_acl_del_%KEY%' title='"._("Delete system")."'>";
+ /* Role handling */
+ $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=list_edit_role'>%s</a>";
+ $list_left_icon = "<img src='images/select_acl_role.png' alt='"._("Role")."'>";
+ $cn = htmlentities(utf8_decode($acl_entry['cn'][0])) ;
+
+ if(isset($acl_entry['description'][0])){
+ $cn .= " [".$acl_entry['description'][0]."]";
+ }
+
+ /* Add copy & paste handler */
+ if(($this->parent->CopyPasteHandler) && preg_match("/(c.*w|w.*c)/",$acl_all)){
+ $action.= "<input class='center' type='image'
+ src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'> ";
+ $action.= "<input class='center' type='image'
+ src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'> ";
+ }
+
+ /* Add actions depending on acls */
+ if(preg_match("/r/", $acl)){
+ $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'
+ name='list_acl_role_edit_%KEY%' title='"._("Edit acl role")."'>";
+ }
+
+ /* Add snapshot functionality */
+ if(preg_match("/(c.*w|w.*c)/", $acl_all)){
+ $action.= $this->GetSnapShotActions($acl_entry['dn']);
+ }
+
+ if(preg_match("/d/", $acl)){
+ $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
+ name='list_acl_role_del_%KEY%' title='"._("Delete acl role")."'>";
+ }
+ }else{
+
+ /* Acl handling */
+ $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=list_edit_entry'>%s</a>";
+ $list_left_icon = "<img src='images/select_acl.png' alt='"._("Acl")."'>";
+ $cn = htmlentities(utf8_decode($acl_entry['dn']));
+
+ /* Add actions depending on acls */
+ if(preg_match("/r/", $acl)){
+ $action.= "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'
+ name='list_acl_edit_%KEY%' title='"._("Edit acl")."'>";
+ }
+ if(preg_match("/d/", $acl)){
+ $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
+ name='list_acl_del_%KEY%' title='"._("Delete acl")."'>";
+ }
}
$field1 = array("string" => $list_left_icon, "attach"=> "style='text-align:center;width:20px;'");
}
$field1 = array("string" => $list_left_icon, "attach"=> "style='text-align:center;width:20px;'");
- $field2 = array("string" => sprintf($editlink,$key,htmlentities(utf8_decode($acl_entry['dn'])))." ","attach" => "");
- $field3 = array("string" => preg_replace("/%KEY%/",$key,$action), "attach"=> "style='text-align:center;width:".$this->action_col_size."px;border-right:0px;'");
+ $field2 = array("string" => sprintf($editlink,$key,$cn)." ","attach" => "");
+ $field3 = array("string" => preg_replace("/%KEY%/",$key,$action), "attach"=> "style='text-align:right;width:".$this->action_col_size."px;border-right:0px;'");
$this->AddElement(array($field1,$field2,$field3));
}
}
$this->AddElement(array($field1,$field2,$field3));
}
}
return(array("gosaAccount","gosaDepartment"));
}
return(array("gosaAccount","gosaDepartment"));
}
+
+ /* Return plugin informations for acl handling */
+ function plInfo()
+ {
+ return (array(
+ "plShortName" => _("ACL")." & "._("ACL roles"),
+ "plDescription" => _("ACL")." & "._("ACL roles")." - ("._("Access control list").")",
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 0,
+ "plSection" => array("administration"),
+ "plCategory" => array("acl" => array("description" => _("ACL")." & "._("ACL roles"),
+ "objectClass" => array("gosaAcl","gosaRole"))),
+ "plProvidedAcls"=> array(
+ "cn" => _("Role name"),
+ "description" => _("Role description"))
+
+ ));
+ }
+
+
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>