X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=trunk%2Fgosa-plugins%2Fgoto%2Faddons%2Fgoto%2Fevents%2Fclass_DaemonEvent_notify.inc;h=35f92060206918782ecdbbd88cdf9e01179a4c38;hb=1df484ade1d24e73f249aca373c179998ff32114;hp=e2599414b2f862d6741603323a87eb4e6fd3b159;hpb=2e8e2597857244ace34b8c8579aae5e9d2db3bdd;p=gosa.git diff --git a/trunk/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_notify.inc b/trunk/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_notify.inc index e2599414b..35f920602 100644 --- a/trunk/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_notify.inc +++ b/trunk/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_notify.inc @@ -187,6 +187,11 @@ class DaemonEvent_notify extends DaemonEvent */ public function add_targets($targets) { + if(isset($targets['OBJECTGROUPS'])){ + $ogroup_targets = $this->resolve_objectgroups($targets['OBJECTGROUPS']); + $targets = array_merge_recursive($targets, $ogroup_targets); + } + if(isset($targets['USERS'])){ $this->add_users($targets['USERS']); } @@ -195,6 +200,41 @@ class DaemonEvent_notify extends DaemonEvent } } + /*! \brief Resolve an object group to the contained users and groups + @param Array A list of all object groups + */ + public function resolve_objectgroups($targets) + { + $result = array(); + + foreach($targets as $ogroup) { + $ldap = $this->config->get_ldap_link(); + $ldap->cd(get_groups_ou().$this->config->current['BASE']); + $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]; + $result['USERS'][] = $uid; + } + elseif (array_search('posixGroup', $attrs['objectClass'])) { + $group = $attrs['cn'][0]; + $result['GROUPS'][] = $group; + } + } + } + } + } + return $result; + } + + + public function save() {