summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 73bb939)
raw | patch | inline | side by side (parent: 73bb939)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 8 Apr 2008 07:39:50 +0000 (07:39 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 8 Apr 2008 07:39:50 +0000 (07:39 +0000) |
-Allow adding groups %
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10268 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10268 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc | patch | blob | history | |
gosa-plugins/sudo/admin/sudo/class_target_list_users.inc | patch | blob | history |
diff --git a/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc b/gosa-plugins/sudo/admin/sudo/class_sudoGeneric.inc
index ffccd2576e83f8bb7c777795d3b4b87fdabeeafb..02d83b68a3080376c9ba97556fafa51cea7491e2 100644 (file)
if(isset($_POST['SaveMultiSelectWindow']) && $this->dialog instanceof target_list_users){
if($this->acl_is_writeable("sudoUser")){
foreach($this->dialog->save() as $entry){
- $cn = trim($entry['uid'][0]);
- if(!in_array($cn,$this->sudoUser) && !in_array("!".$cn,$this->sudoUser)){
- $this->sudoUser[] = $cn;
+ if(in_array("posixGroup",$entry['objectClass'])){
+ $name = trim("%".$entry['cn'][0]);
+ }else{
+ $name = trim($entry['uid'][0]);
+ }
+ if(!in_array($name,$this->sudoUser) && !in_array("!".$name,$this->sudoUser)){
+ $this->sudoUser[] = $name;
}
}
}
$neg_img= "<img src='images/negate.png' alt='!' class='center'>";
$option = "<input type='image' src='images/negate.png' name='neg_%ATTR%_%KEY%' class='center'>";
$option.= "<input type='image' src='images/edittrash.png' name='del_%ATTR%_%KEY%' class='center'>";
- foreach(array("sudoUser","sudoCommand","sudoHost","sudoRunAs") as $attr){
+ foreach(array("sudoCommand","sudoHost","sudoRunAs") as $attr){
if($this->acl_is_readable($attr)){
foreach($this->$attr as $key => $entry){
- $entry = preg_replace("/^!/",$neg_img,$entry);
+ $neg = "";
+ if(preg_match("/^!/",$entry)){
+ $neg = $neg_img;
+ }
+ $entry = preg_replace("/^!/","",$entry);
$list_name = "divlist_".$attr;
$$list_name->AddEntry(
array(
+ array("string" => $neg,"attach" => "style='width:18px;'"),
array("string" => $entry),
array("string" => preg_replace(array("/%KEY%/","/%ATTR%/"),array($key,$attr),$option),
"attach" => "style='width:40px; border-right: 0px;'")));
}
}
+ foreach(array("sudoUser") as $attr){
+ $img1 = "<img src='images/select_user.png' alt='"._("User")."'>";
+ $img2 = "<img src='images/select_groups.png' alt='"._("Group")."'>";
+ if($this->acl_is_readable($attr)){
+ foreach($this->$attr as $key => $entry){
+ $neg = "";
+ if(preg_match("/^!/",$entry)){
+ $neg = $neg_img;
+ }
+ $entry = preg_replace("/^!/","",$entry);
+
+ $img = $img1;
+ if(preg_match("/^%/",$entry)){
+ $img = $img2;
+ }
+ $entry = preg_replace("/^%/","",$entry);
+
+ $list_name = "divlist_".$attr;
+ $$list_name->AddEntry(
+ array(
+ array("string" => $neg,"attach" => "style='width:18px;'"),
+ array("string" => $img,"attach" => "style='width:18px;'"),
+ array("string" => $entry),
+ array("string" => preg_replace(array("/%KEY%/","/%ATTR%/"),array($key,$attr),$option),
+ "attach" => "style='width:40px; border-right: 0px;'")));
+ }
+ }
+ }
+
+
+
+
/* Tell smarty about our divlists
*/
$smarty->assign("divlist_sudoUser", $divlist_sudoUser->DrawList());
diff --git a/gosa-plugins/sudo/admin/sudo/class_target_list_users.inc b/gosa-plugins/sudo/admin/sudo/class_target_list_users.inc
index 227e328bd0fc914109e0cd333fd511b2723e41bc..1640c3d74ebe16c9297d0574fb1e2eea86cbc133 100644 (file)
/* CheckBoxes, to change default values modify $this->AddCheckBox */
var $user ;
+ var $group ;
/* Subsearch checkbox */
$this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
$this->AddHeader(array("string" => _("Object name"), "attach" => "style=''"));
+ $this->AddCheckBox("user", _("Select to see users") ,_("Show users"), true);
+ $this->AddCheckBox("group", _("Select to see groups"),_("Show groups"), true);
+
+ /* Add SubSearch checkbox */
+ $this->AddCheckBox(SEPERATOR);
+
/* Add SubSearch checkbox */
$this->AddCheckBox("SubSearch", msgPool::selectToView("","subsearch"), msgPool::selectToView("","subsearch_small"), false);
$desc = " - [ ".$val['description'][0]." ]";
}
- $img = "<img src='images/select_user.png' alt='"._("Use")."' ".$title.">";
+ $img1 = "<img src='images/select_user.png' alt='"._("User")."' ".$title.">";
+ $img2 = "<img src='images/select_groups.png' alt='"._("Group")."' ".$title.">";
+
+ if(in_array("posixGroup",$val['objectClass'])){
+ $img = $img2;
+ }else{
+ $img = $img1;
+ }
/* Create each field */
$field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
$filter= "(&(cn=".$Regex.")(|".$filter."))";
if($this->SubSearch){
- $res= get_sub_list($filter, array("users"), array(get_people_ou()),$base,
- array("cn","uid","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH);
+ $res = array();
+ if($this->user){
+ $filter = "(&(objectClass=person)(objectClass=gosaAccount))";
+ $filter= "(&(cn=".$Regex.")(|".$filter."))";
+ $res= array_merge($res,get_sub_list($filter, array("users"), array(get_people_ou()),$base,
+ array("cn","uid","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH));
+ }
+ if($this->group){
+ $filter = "(objectClass=posixGroup)";
+ $filter= "(&(cn=".$Regex.")(|".$filter."))";
+ $res= array_merge($res,get_sub_list($filter, array("groups"), array(get_groups_ou()),$base,
+ array("cn","uid","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH));
+ }
}else{
$res= get_list($filter, array("users"), get_people_ou().$base,
array("cn","uid","objectClass","description"), GL_SIZELIMIT );
+ $res = array();
+ if($this->user){
+ $filter = "(&(objectClass=person)(objectClass=gosaAccount))";
+ $filter= "(&(cn=".$Regex.")(|".$filter."))";
+ $res= array_merge($res,get_list($filter, array("users"), get_people_ou().$base,
+ array("cn","uid","objectClass","description"), GL_SIZELIMIT ));
+ }
+ if($this->group){
+ $filter = "(objectClass=posixGroup)";
+ $filter= "(&(cn=".$Regex.")(|".$filter."))";
+ $res= array_merge($res,get_list($filter, array("groups"), get_groups_ou().$base,
+ array("cn","uid","objectClass","description"), GL_SIZELIMIT ));
+ }
}
$this->list= $res;