summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e342640)
raw | patch | inline | side by side (parent: e342640)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 21 Jan 2010 12:43:00 +0000 (12:43 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 21 Jan 2010 12:43:00 +0000 (12:43 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15232 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 1d315f7fe8528b46d351ffdc5645745b3d7fda57..ad4f87cfdec9e8f91735d68138dcf84fac543fc6 100644 (file)
foreach($this->dialog->save() as $entry){
if(in_array("posixGroup",$entry['objectClass'])){
$name = trim("%".$entry['cn'][0]);
- }else{
+ }elseif(isset($entry['uid'][0])){
$name = trim($entry['uid'][0]);
+ }else{
+ print_a($entry);
}
if(!in_array($name,$this->sudoUser) && !in_array("!".$name,$this->sudoUser)){
$this->sudoUser[] = $name;
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 c903563e159a8ad798556d65be3d25dfc9c45b5c..6e841ac551f5b7d6d0dee06f91453bb5b10f498d 100644 (file)
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-class target_list_users extends MultiSelectWindow
+class target_list_users extends management
{
- public $config;
- private $list =array();
- private $Targets_used =array();
+ // Tab definition
+ protected $skipFooter = TRUE;
+ protected $skipHeader = TRUE;
- /* Regex */
- protected $Regex = "*";
-
- /* CheckBoxes, to change default values modify $this->AddCheckBox */
- protected $user ;
- protected $group ;
-
- /* Subsearch checkbox */
- protected $SubSearch ;
- protected $parent ;
- protected $ui ;
-
- function target_list_users(&$config,$Targets_used)
- {
- MultiSelectWindow::MultiSelectWindow($config, "Targetselection", array("users"));
-
- $this->Targets_used = $Targets_used;
-
- $this->SetInformation( _("Select the target objects"));
- $this->SetTitle( _("Available members"));
- $this->SetSummary( _("Available members"));
- $this->SetHeadpageMode(FALSE);
-
- /* set Page header */
- $chk = "<input type='checkbox' id='select_all' name='select_all'
- onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
- $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
-
- $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);
-
- /* Name,Text,Default , Connect with alphabet */
- $this->AddRegex ("Regex", _("Regular expression for matching group names"), "*" , true);
- $this->EnableAplhabet(TRUE);
- }
-
-
- function GenHeader()
+ function __construct($config,$ui)
{
- $options= "";
-
- /* Get all departments within this subtree */
- $ui= get_userinfo();
- $first = "";
- $found = FALSE;
- $base = $this->config->current['BASE'];
-
- /* Add base */
- $tmp = array();
- $tmp[] = array("dn"=>$this->config->current['BASE']);
- $tmp= array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
- array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
- $deps = array();
- foreach($tmp as $tm){
- $deps[$tm['dn']] = $tm['dn'];
- }
-
- /* Load possible departments */
- $ui= get_userinfo();
- $tdeps= $ui->get_module_departments("users");
- $ids = $this->config->idepartments;
- $first = "";
- $found = FALSE;
- foreach($ids as $dep => $name){
- if(isset($deps[$dep]) && in_array_ics($dep, $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];
- if ($this->selectedBase == $dep){
- $found = TRUE;
- $options.= "<option selected='selected' value='".$dep."'>$value</option>";
- } else {
- $options.= "<option value='".$dep."'>$value</option>";
- }
- }
- }
-
- /* The currently used base is not visible with your acl setup.
- * Set base to first useable base.
- */
- if(!$found){
- $this->selectedBase = $first;
- }
-
- /* Get copy & paste icon */
- $acls = $ui->get_permissions($this->selectedBase,"user/user");
- $acl_all= $ui->has_complete_category_acls($this->selectedBase,"users");
-
- /* Add default header */
- $listhead = MultiSelectWindow::get_default_header();
-
- /* Add department selector */
- $listhead .= _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
- " <input class='center' type='image' src='images/lists/submit.png' align='middle'
- title='"._("Apply")."' name='submit_department' alt='"._("Submit")."'> ";
- $listhead .="</div>";
-
- $this->SetListHeader($listhead);
+ $this->config = $config;
+ $this->ui = $ui;
+ $this->storagePoints = array(get_ou("userRDN"), get_ou("groupRDN"));
+
+# // Build filter
+# if (session::global_is_set(get_class($this)."_filter")){
+# $filter= session::global_get(get_class($this)."_filter");
+# } else {
+ $filter = new filter(get_template_path("selectUser-filter.xml", true));
+ $filter->setObjectStorage($this->storagePoints);
+# }
+ $this->setFilter($filter);
+
+ // Build headpage
+ $headpage = new listing(get_template_path("selectUser-list.xml", true));
+ $headpage->setFilter($filter);
+ parent::__construct($config, $ui, "object", $headpage);
}
+ function save_object() {}
function execute()
{
- $this->ClearElementsList();
- $this->GenHeader();
- $this->reload();
- $this->SetEntries($this->list);
- return($this->Draw());
+ $str = management::execute();
+ $str.= "<p class='separator'> </p>
+ <p style=\"text-align:right\">
+ <input type=submit name=\"SaveMultiSelectWindow\" value=\"".msgPool::okButton()."\">
+
+ <input type=submit name=\"CloseMultiSelectWindow\" value=\"".msgPool::cancelButton()."\">
+ </p>";
+ return($str);
}
-
- function SetEntries($list)
- {
- /* Add Copy & Paste buttons if copy&paste is enabled
- */
- // Defining Links
- $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
-
- $ui = get_userinfo();
-
- // Assigning users
- foreach($list as $key => $val){
-
- if(in_array($val['cn'][0],$this->Targets_used)) continue;
-
- $title = "title='".preg_replace('/ /', ' ', LDAP::fix($val['dn']))."'";
- if(!isset($val['description'][0])){
- $desc = "";
- }else{
- $desc = " - [ ".$val['description'][0]." ]";
- }
-
- $img1 = "<img src='plugins/users/images/select_user.png' alt='"._("User")."' ".$title.">";
- $img2 = "<img src='plugins/groups/images/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."'>" ,
- "attach" => "style='width:20px;'");
- $field1 = array("string" => $img,
- "attach" => "style='text- align:center;width: 20px;'");
- $field2 = array("string" => $val['cn'][0].$desc,
- "attach" => "style='border-right:0px;' ".$title);
-
- $this->AddElement(array($field0,$field1,$field2));
- }
- }
-
-
function save()
- {
+ {
+ $act = $this->detectPostActions();
+ $headpage = $this->getHeadpage();
+ if(!isset($act['targets'])) return(array());
$ret = array();
- $items = $this->list_get_selected_items();
- foreach($items as $item){
- $ret[] = $this->list[$item];
+ foreach($act['targets'] as $dn){
+ $ret[] = $headpage->getEntry($dn);
}
return($ret);
}
-
-
- function save_object()
- {
- MultiSelectWindow::save_object();
- }
-
-
- function reload()
- {
- /* Set base for all searches && initialise some vars */
- $this->list= array();
- $base = $this->selectedBase;
- $Regex = $this->Regex;
-
- /* Create filter */
-
- if($this->SubSearch){
- $res = array();
- if($this->user){
- $filter = "(&(objectClass=person)(objectClass=gosaAccount))";
- $filter= "(&(|(cn=".$Regex.")(uid=".$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.")(uid=".$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 = array();
- if($this->user){
- $filter = "(&(objectClass=person)(objectClass=gosaAccount))";
- $filter= "(&(|(cn=".$Regex.")(uid=".$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.")(uid=".$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;
- ksort ($this->list);
- reset ($this->list);
- $tmp=array();
- foreach($this->list as $tkey => $val ){
- $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
- }
- ksort($tmp);
- $this->list=array();
- foreach($tmp as $val){
- $this->list[]=$val;
- }
- reset ($this->list);
- }
-
- function list_get_selected_items()
- {
- $ids = array();
- foreach($_POST as $name => $value){
- if(preg_match("/^item_selected_[0-9]*$/",$name)){
- $id = preg_replace("/^item_selected_/","",$name);
- $ids[$id] = $id;
- }
- }
- return($ids);
- }
}
-
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>