54a55,57 > # schaefer 2007-06-13 strange, but required (bad place?) > $TWiki::Plugins::SESSION = $session; > 123a127,142 > ---++ ObjectMethod getGroupMemberNames($group_name) > * =$group_name= - Name of group (wikiname with no web) > Returns the list of the named group's members (the wikinames with no web) > > =cut > > sub getGroupMemberNames { > my ($this, $group_name) = @_; > > my $group = $this->{session}->{users}->findUser($group_name); > > return map($_->wikiName(), @{$group->groupMembers()}); > } > > =pod > 134a154,171 > # schaefer 2007-06-23 implement group subscription as multiple > # subscription. > # NOTES > # - As far as we saw, we didn't understand how group could work, and > # it was easier to do it that way. > # - Supports groups containing groups. > # - We saw some duplicate subscriptions, however apparently no > # duplicate mails. > # BUGS > # - Infinite recursion will not be detected. > if ($name =~ /Group$/) { > foreach my $member ($this->getGroupMemberNames($name)) { > subscribe($this, $member, $topics, $depth); > } > > return > } > 154a192,205 > # schaefer 2007-06-23 implement group unsubscription as multiple > # unsubscription. > # NOTES > # - Supports groups containing groups. > # BUGS > # - Infinite recursion will not be detected. > if ($name =~ /Group$/) { > foreach my $member ($this->getGroupMemberNames($name)) { > unsubscribe($this, $member, $topics, $depth); > } > > return > } > 198a250,279 > my $do_log = 0; > > local (*FILE); > if (defined($TWiki::cfg{MailerContrib}{NotifyLog})) { > $do_log = 1; > > if (open(FILE, ">>", $TWiki::cfg{MailerContrib}{NotifyLog})) { > $do_log = 1; > my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) > = localtime(time); > print FILE "Notify run: ", > sprintf("%.2d-%.2d-%.2d %d:%d", > $year + 1900, > $mon + 1, > $mday, > $hour, > $min), > " ", > $topic, > "\n"; > } > else { > print STDERR "cannot open log file ", > $TWiki::cfg{MailerContrib}{NotifyLog}, > ": ", > $!, > "\n"; > } > } > 201a283,299 > # schaefer 2007-06-13 only show changes if access allowed > # NOTES > # - if this is an e-mail address, apply permission checks > # to the TWikiGuest user (NEW 2007-06-26). > # - if this is a group, we need to expand to users in a loop > # (semantic: a group just represents users) (NEW 2007-06-26) > # implemented at subscription adding time in subscribe() > # and unsubscribe() > # BUGS > # TODO > my $the_user = 'Main.' . $name; > > # validate an e-mail address through TWikiGuest's credentials. > if ($name =~ /^$TWiki::regex{emailAddrRegex}/o) { > $the_user = 'Main.TWikiGuest'; > } > 203a302,319 > if ($TWiki::cfg{MailerContrib}{CheckPermissions}) { > if (!TWiki::Func::checkAccessPermission('VIEW', > $the_user, > undef, > $topic, > $this->{web})) { > print STDERR "checkAccessPermission failed: ", > $name, > " ", > $topic, > " ", > $this->{web}, > " auth check ", > $the_user, "\n"; > next; > } > } > 206a323,329 > if ($do_log) { > print FILE " * subscriber: ", > $the_user, " e-mails: ", > join(', ', @$emails), > "\n"; > } > 217a341,344 > > if ($do_log) { > close(FILE); # err. ign. > }