summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1309353)
raw | patch | inline | side by side (parent: 1309353)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 8 Oct 2009 12:38:20 +0000 (12:38 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 8 Oct 2009 12:38:20 +0000 (12:38 +0000) |
- Build a proper $target array for the add_targets function,
containing group names and uids. Fixes problems with object group
members not added to the target list of a notification event.
- Add message checks
- Save notify object before handing it to gosa-si
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@14564 594d385d-05f5-0310-b6e9-bd551577e9d8
containing group names and uids. Fixes problems with object group
members not added to the target list of a notification event.
- Add message checks
- Save notify object before handing it to gosa-si
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@14564 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc | patch | blob | history |
diff --git a/trunk/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc b/trunk/gosa-core/plugins/admin/ogroups/class_ogroupManagement.inc
index ece1e48ece05d3095c452e6401fbe7cb417d5991..5e5b985d2543704226d17410b346c1d0b597c864 100644 (file)
if(preg_match("/^event_/",$s_action) && class_available("DaemonEvent")){
$ids = $this->list_get_selected_items();
- $uids = array();
+ /* Resolve the selected items to their corresponding uids and group names */
+ $targets = array();
foreach($ids as $id){
- $uids[] = $this->ogrouplist[$id]['cn'][0];
+ $ogroup = $this->ogrouplist[$id]['cn'][0];
+ $ldap = $this->config->get_ldap_link();
+ $ldap->search("(&(cn=".$ogroup.")(member=*))", array('member'));
+
+ while ($entry = $ldap->fetch()) {
+ $members = $entry['member'];
+ for($i=0;$i<$members['count'];$i++) {
+ $ldap->cat($members[$i], array('uid','cn','objectClass'));
+ if ($ldap->count() > 0) {
+ $attrs = $ldap->fetch();
+
+ /* Determine which type the object has */
+ 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)){
+ 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;
+ }
}
}