summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d853cc4)
raw | patch | inline | side by side (parent: d853cc4)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 20 Oct 2009 09:15:26 +0000 (09:15 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 20 Oct 2009 09:15:26 +0000 (09:15 +0000) |
-Send messages to correct recipients.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14609 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14609 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc | patch | blob | history |
diff --git a/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc b/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc
index ece1e48ece05d3095c452e6401fbe7cb417d5991..49a434fcfcf5272ac61848599950889180722f47 100644 (file)
********************/
if(preg_match("/^event_/",$s_action) && class_available("DaemonEvent")){
+
+ /* Resolve the selected items to their corresponding uids and group names */
$ids = $this->list_get_selected_items();
- $uids = array();
+ $targets = array();
+ $m_list = array();
+ $ldap = $this->config->get_ldap_link();
+
+ // Collect selected ogroups
foreach($ids as $id){
- $uids[] = $this->ogrouplist[$id]['cn'][0];
+ $ogroup = $this->ogrouplist[$id]['cn'][0];
+ $ldap->search("(&(cn=".$ogroup.")(member=*))", array('member'));
+ while ($entry = $ldap->fetch()) {
+ $m_list[] = $entry;
+ }
+ }
+
+ // Collect object group member dns
+ foreach($m_list as $entry){
+ $members = $entry['member'];
+ for($i=0;$i<$members['count'];$i++) {
+
+ // Fetch member object
+ $ldap->cat($members[$i], array('uid','cn','objectClass'));
+ if ($ldap->count() > 0) {
+
+ // Determine which type the object has
+ $attrs = $ldap->fetch();
+ if (array_search('gosaAccount', $attrs['objectClass'])) {
+ $uid = $attrs['uid'][0];
+ $targets['USERS'][] = $uid;
+ }elseif (array_search('posixGroup', $attrs['objectClass'])) {
+ $group = $attrs['cn'][0];
+ $targets['GROUPS'][] = $group;
+ }
+ }
+ }
}
- if(count($uids)){
+
+ // We've at least one recipient
+ if(count($targets)){
$events = DaemonEvent::get_event_types(USER_EVENT);
$event = preg_replace("/^event_/","",$s_action);
if(isset($events['BY_CLASS'][$event])){
$type = $events['BY_CLASS'][$event];
$this->ogroup = new $type['CLASS_NAME']($this->config);
- $this->ogroup->add_targets($uids);
+ $this->ogroup->add_targets($targets);
$this->ogroup->set_type(TRIGGERED_EVENT);
}
}
/* Save event */
if(isset($_POST['save_event_dialog'])){
- $o_queue = new gosaSupportDaemon();
- $o_queue->append($this->ogroup);
- if($o_queue->is_error()){
- msg_dialog::display(_("Infrastructure error"), msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
- }else{
- $this->ogroup = FALSE;
+ $this->ogroup->save_object();
+ $msgs = $this->ogroup->check();
+ if (count($msgs)) {
+ msg_dialog::displayChecks($msgs);
+ }
+ else {
+ $o_queue = new gosaSupportDaemon();
+ $o_queue->append($this->ogroup);
+ if($o_queue->is_error()){
+ msg_dialog::display(_("Infrastructure error"), msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
+ }else{
+ $this->ogroup = FALSE;
+ }
}
}