From: cajus Date: Mon, 31 Mar 2008 12:33:19 +0000 (+0000) Subject: Added dummy function for adapting from templates for existing entries X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d7c323ca1a50b9290cb7a22b0d3a5f3c4ff37dff;p=gosa.git Added dummy function for adapting from templates for existing entries git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10084 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/admin/users/class_divListUsers.inc b/gosa-core/plugins/admin/users/class_divListUsers.inc index eddb2bd02..33bb37809 100644 --- a/gosa-core/plugins/admin/users/class_divListUsers.inc +++ b/gosa-core/plugins/admin/users/class_divListUsers.inc @@ -185,6 +185,8 @@ class divListUsers extends MultiSelectWindow " "._("Change password")."|"."multiple_password_change|\n"; $s.= "..|". " "._("Remove")."|"."remove_multiple|\n"; + $s.= "..|". + " "._("Apply template")."|"."templatize_multiple|\n"; /* Add event tag */ if(class_available("DaemonEvent")){ diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc index 5fa8b0156..cc9ba18c8 100644 --- a/gosa-core/plugins/admin/users/class_userManagement.inc +++ b/gosa-core/plugins/admin/users/class_userManagement.inc @@ -152,6 +152,9 @@ class userManagement extends plugin if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){ $s_action = "del_multiple"; } + if(isset($_POST['menu_action']) && preg_match("/^templatize_multiple/",$_POST['menu_action'])){ + $s_action = "templatize_multiple"; + } if(isset($_POST['menu_action']) && preg_match("/^event/",$_POST['menu_action'])){ $s_action = $_POST['menu_action']; @@ -433,6 +436,34 @@ class userManagement extends plugin session::un_set('objectinfo'); } + /* Apply templates */ + if ($s_action=="templatize_multiple"){ + $ids = $this->list_get_selected_items(); + $this->dns = array(); + if(count($ids)){ + + foreach($ids as $id){ + $dn = $this->list[$id]['dn']; + if (($user= get_lock($dn)) != ""){ + return(gen_locked_message ($user, $dn)); + } + $this->dns[$id] = $dn; + } + } + + # Test stuff + foreach ($this->dns as $dn){ + + echo "Template test with '$dn'
"; + $template_dn= "cn=super44 super44,ou=people,dc=gonicus,dc=de"; + $usertab= new usertabs($this->config, $this->config->data['TABS']['USERTABS'], $dn); + $usertab->adapt_from_template($template_dn, array("sn", "givenName", "uid")); + #$usertab->save(); + unset ($usertab); + $usertab= NULL; + } + + } /******************** Delete MULTIPLE entries requested, display confirm dialog @@ -1152,7 +1183,7 @@ class userManagement extends plugin function remove_from_parent() { } function check() { } function save() { } - function adapt_from_template($dn) { } + function adapt_from_template($dn, $skip= array()) { } function password_change_needed() { } } /* ... class userManagement */