summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2b8c643)
raw | patch | inline | side by side (parent: 2b8c643)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 11 Oct 2010 15:44:09 +0000 (15:44 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 11 Oct 2010 15:44:09 +0000 (15:44 +0000) |
-Fixed saving of ogroup members, check for valid accounts first,
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19983 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19983 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/groupware/admin/ogroups/DistributionList/class_DistributionList.inc | patch | blob | history |
diff --git a/gosa-plugins/groupware/admin/ogroups/DistributionList/class_DistributionList.inc b/gosa-plugins/groupware/admin/ogroups/DistributionList/class_DistributionList.inc
index cad5542ed61ceae09000a9157626bc196f299d79..0d08fa5009402ec716dfa1e316b0f21e96a90394 100644 (file)
return;
}
- print_a(array("memberList" => $memberList));
-
// Now get the primary mail address
$primaryMailAddress = $rpc->gwDistGetPrimaryMailAddress($this->orig_cn);
if(!$rpc->success()){
}
- /*! \brief Gets the mail addresses for the ogroups members.
- * This will then be stored together with the dist list.
+ /*! \brief Gets the uids for the ogroups members.
*/
function getOgroupMemberList()
{
$members = array();
foreach($this->parent->by_object['ogroup']->memberList as $dn => $data){
if($data['type'] == 'U'){
- $ldap->cat($dn, array('mail'));
+ $ldap->cat($dn, array('uid'));
if($ldap->count()){
$attrs = $ldap->fetch();
- if(isset($attrs['mail'][0])) $members[] = $attrs['mail'][0];
+ if(isset($attrs['uid'][0])) $members[] = $attrs['uid'][0];
}
}
}
// Update member list
$this->memberList = $this->getOgroupMemberList();
- print_a(array("memberList" => $this->memberList));
- $all = array_merge($this->memberList, $this->saved_attributes['memberList']);
+
+ // Check which accounts have valid groupware mail addresses.
+ $uids = $this->getOgroupMemberList();
+ $rpc = $this->config->getRpcHandle();
+ $verified = $rpc->gwVerifyAcct($uids);
+ $hasExt = array();
+ if(!$rpc->success()){
+ $messages[] = sprintf(_("Failed to verify account ids! Error was: '%s'."),$rpc->get_error());
+ }else{
+ $hasExt = array();
+ foreach($verified as $uid => $mail){
+ if(!empty($mail)) $hasExt[] = $mail;
+ }
+ }
+ $all = array_merge($hasExt, $this->saved_attributes['memberList']);
foreach($all as $member){
- if(!in_array($member,$this->memberList)){
- echo "<br>Del {$member}";
+ if(!in_array($member,$hasExt)){
$rpc->gwDistDelMember($this->cn, $member);
if(!$rpc->success()){
$message = sprintf(_("Failed to remove member '%s' from distribution list '%s'! Error was: '%s'."),
msg_dialog::display(_("Error"),msgPool::rpcError($message), ERROR_DIALOG);
}
}elseif(!in_array($member,$this->saved_attributes['memberList'])){
- echo "<br>Add {$member}";
$rpc->gwDistAddMember($this->cn, $member);
if(!$rpc->success()){
$message = sprintf(_("Failed to add member '%s' to distribution list '%s'! Error was: '%s'."),
msg_dialog::display(_("Permission error"), _("You have no permission to modify these addresses!"), ERROR_DIALOG);
}
}
+
+
+ function check()
+ {
+ $messages = plugin::check();
+
+ // Check which accounts have valid groupware mail addresses.
+ $uids = $this->getOgroupMemberList();
+ $rpc = $this->config->getRpcHandle();
+ $verified = $rpc->gwVerifyAcct($uids);
+ if(!$rpc->success()){
+ $messages[] = sprintf(_("Failed to verify account ids! Error was: '%s'."),$rpc->get_error());
+ }else{
+ $noExt = array();
+ foreach($verified as $uid => $mail){
+ if(empty($mail)) $noExt[] = $uid;
+ }
+ if(count($noExt)){
+ $message = sprintf(_("The following object group members do not have a valid groupware extension and will be ignored as distribution list members: %s"),msgPool::buildList($noExt));
+ msg_dialog::display(_("Info"),$message, INFO_DIALOG);
+ }
+ }
+
+ return($messages);
+ }
}
?>