diff options
| author | fukachan <fukachan> | 2004-05-01 05:02:03 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2004-05-01 05:02:03 +0000 |
| commit | eabc7e06a8501af1aaf352cfd6b49cd290e0053e (patch) | |
| tree | 8f23b2f85fb3984140207d4891e3053f5daae1c9 | |
| parent | f68c2be0df4a615f2a5722839f7241f818b12a2d (diff) | |
| download | fml8-eabc7e06a8501af1aaf352cfd6b49cd290e0053e.tar.gz fml8-eabc7e06a8501af1aaf352cfd6b49cd290e0053e.tar.bz2 fml8-eabc7e06a8501af1aaf352cfd6b49cd290e0053e.zip | |
asymmetric user control
| -rw-r--r-- | fml/lib/FML/Command/Admin/add2active.pm | 65 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/add2actives.pm | 65 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/add2member.pm | 65 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/add2members.pm | 65 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/add2recipient.pm | 65 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/add2recipients.pm | 65 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/addactive.pm | 65 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/addactives.pm | 65 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/addmember.pm | 177 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/addmembers.pm | 65 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/addrecipient.pm | 177 | ||||
| -rw-r--r-- | fml/lib/FML/Command/Admin/addrecipients.pm | 65 |
12 files changed, 1004 insertions, 0 deletions
diff --git a/fml/lib/FML/Command/Admin/add2active.pm b/fml/lib/FML/Command/Admin/add2active.pm new file mode 100644 index 00000000..5899c637 --- /dev/null +++ b/fml/lib/FML/Command/Admin/add2active.pm @@ -0,0 +1,65 @@ +#-*- perl -*- +# +# Copyright (C) 2004 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: add.pm,v 1.9 2004/01/02 14:42:42 fukachan Exp $ +# + +package FML::Command::Admin::add2active; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +use FML::Command::Admin::addrecipient; +@ISA = qw(FML::Command::Admin::addrecipient); + + +# Descriptions: add user as only recipient +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: forward request to addrecipient module +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + $self->SUPER::process($curproc, $command_args); +} + +=head1 NAME + +FML::Command::Admin::add - add a new recipient (recipient only) + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +an alias of C<FML::Command::Admin::addrecipient>. + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2004 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::Admin::add first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/Admin/add2actives.pm b/fml/lib/FML/Command/Admin/add2actives.pm new file mode 100644 index 00000000..9d7e673b --- /dev/null +++ b/fml/lib/FML/Command/Admin/add2actives.pm @@ -0,0 +1,65 @@ +#-*- perl -*- +# +# Copyright (C) 2004 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: add.pm,v 1.9 2004/01/02 14:42:42 fukachan Exp $ +# + +package FML::Command::Admin::add2actives; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +use FML::Command::Admin::addrecipient; +@ISA = qw(FML::Command::Admin::addrecipient); + + +# Descriptions: add user as only recipient +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: forward request to addrecipient module +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + $self->SUPER::process($curproc, $command_args); +} + +=head1 NAME + +FML::Command::Admin::add - add a new recipient (recipient only) + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +an alias of C<FML::Command::Admin::addrecipient>. + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2004 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::Admin::add first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/Admin/add2member.pm b/fml/lib/FML/Command/Admin/add2member.pm new file mode 100644 index 00000000..05e81ba6 --- /dev/null +++ b/fml/lib/FML/Command/Admin/add2member.pm @@ -0,0 +1,65 @@ +#-*- perl -*- +# +# Copyright (C) 2004 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: add.pm,v 1.9 2004/01/02 14:42:42 fukachan Exp $ +# + +package FML::Command::Admin::add2member; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +use FML::Command::Admin::addmember; +@ISA = qw(FML::Command::Admin::addmember); + + +# Descriptions: add user as only member +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: forward request to addmember module +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + $self->SUPER::process($curproc, $command_args); +} + +=head1 NAME + +FML::Command::Admin::add - add a new member (member only) + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +an alias of C<FML::Command::Admin::addmember>. + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2004 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::Admin::add first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/Admin/add2members.pm b/fml/lib/FML/Command/Admin/add2members.pm new file mode 100644 index 00000000..1111eb3f --- /dev/null +++ b/fml/lib/FML/Command/Admin/add2members.pm @@ -0,0 +1,65 @@ +#-*- perl -*- +# +# Copyright (C) 2004 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: add.pm,v 1.9 2004/01/02 14:42:42 fukachan Exp $ +# + +package FML::Command::Admin::add2members; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +use FML::Command::Admin::addmember; +@ISA = qw(FML::Command::Admin::addmember); + + +# Descriptions: add user as only member +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: forward request to addmember module +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + $self->SUPER::process($curproc, $command_args); +} + +=head1 NAME + +FML::Command::Admin::add - add a new member (member only) + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +an alias of C<FML::Command::Admin::addmember>. + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2004 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::Admin::add first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/Admin/add2recipient.pm b/fml/lib/FML/Command/Admin/add2recipient.pm new file mode 100644 index 00000000..070f159e --- /dev/null +++ b/fml/lib/FML/Command/Admin/add2recipient.pm @@ -0,0 +1,65 @@ +#-*- perl -*- +# +# Copyright (C) 2004 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: add.pm,v 1.9 2004/01/02 14:42:42 fukachan Exp $ +# + +package FML::Command::Admin::add2recipient; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +use FML::Command::Admin::addrecipient; +@ISA = qw(FML::Command::Admin::addrecipient); + + +# Descriptions: add user as only recipient +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: forward request to addrecipient module +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + $self->SUPER::process($curproc, $command_args); +} + +=head1 NAME + +FML::Command::Admin::add - add a new recipient (recipient only) + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +an alias of C<FML::Command::Admin::addrecipient>. + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2004 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::Admin::add first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/Admin/add2recipients.pm b/fml/lib/FML/Command/Admin/add2recipients.pm new file mode 100644 index 00000000..6f8ab199 --- /dev/null +++ b/fml/lib/FML/Command/Admin/add2recipients.pm @@ -0,0 +1,65 @@ +#-*- perl -*- +# +# Copyright (C) 2004 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: add.pm,v 1.9 2004/01/02 14:42:42 fukachan Exp $ +# + +package FML::Command::Admin::add2recipients; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +use FML::Command::Admin::addrecipient; +@ISA = qw(FML::Command::Admin::addrecipient); + + +# Descriptions: add user as only recipient +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: forward request to addrecipient module +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + $self->SUPER::process($curproc, $command_args); +} + +=head1 NAME + +FML::Command::Admin::add - add a new recipient (recipient only) + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +an alias of C<FML::Command::Admin::addrecipient>. + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2004 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::Admin::add first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/Admin/addactive.pm b/fml/lib/FML/Command/Admin/addactive.pm new file mode 100644 index 00000000..93e4734d --- /dev/null +++ b/fml/lib/FML/Command/Admin/addactive.pm @@ -0,0 +1,65 @@ +#-*- perl -*- +# +# Copyright (C) 2004 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: add.pm,v 1.9 2004/01/02 14:42:42 fukachan Exp $ +# + +package FML::Command::Admin::addactive; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +use FML::Command::Admin::addrecipient; +@ISA = qw(FML::Command::Admin::addrecipient); + + +# Descriptions: add user as only recipient +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: forward request to addrecipient module +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + $self->SUPER::process($curproc, $command_args); +} + +=head1 NAME + +FML::Command::Admin::add - add a new recipient (recipient only) + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +an alias of C<FML::Command::Admin::addrecipient>. + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2004 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::Admin::add first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/Admin/addactives.pm b/fml/lib/FML/Command/Admin/addactives.pm new file mode 100644 index 00000000..bc828b69 --- /dev/null +++ b/fml/lib/FML/Command/Admin/addactives.pm @@ -0,0 +1,65 @@ +#-*- perl -*- +# +# Copyright (C) 2004 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: add.pm,v 1.9 2004/01/02 14:42:42 fukachan Exp $ +# + +package FML::Command::Admin::addactives; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +use FML::Command::Admin::addrecipient; +@ISA = qw(FML::Command::Admin::addrecipient); + + +# Descriptions: add user as only recipient +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: forward request to addrecipient module +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + $self->SUPER::process($curproc, $command_args); +} + +=head1 NAME + +FML::Command::Admin::add - add a new recipient (recipient only) + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +an alias of C<FML::Command::Admin::addrecipient>. + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2004 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::Admin::add first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/Admin/addmember.pm b/fml/lib/FML/Command/Admin/addmember.pm new file mode 100644 index 00000000..23c556da --- /dev/null +++ b/fml/lib/FML/Command/Admin/addmember.pm @@ -0,0 +1,177 @@ +#-*- perl -*- +# +# Copyright (C) 2004 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: on.pm,v 1.19 2004/04/30 13:38:05 fukachan Exp $ +# + +package FML::Command::Admin::addmember; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +=head1 NAME + +FML::Command::Admin::addmember - add member (member only) + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +change delivery mode from digest to real time. + +=head1 METHODS + +=head2 process($curproc, $command_args) + +=cut + + +# Descriptions: constructor +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: OBJ +sub new +{ + my ($self) = @_; + my ($type) = ref($self) || $self; + my $me = {}; + return bless $me, $type; +} + + +# Descriptions: need lock or not +# Arguments: none +# Side Effects: none +# Return Value: NUM( 1 or 0) +sub need_lock { 1;} + + +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + +# Descriptions: verify the syntax command string. +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: none +# Return Value: NUM(1 or 0) +sub verify_syntax +{ + my ($self, $curproc, $command_args) = @_; + + use FML::Command::Syntax; + push(@ISA, qw(FML::Command::Syntax)); + $self->check_syntax_address_handler($curproc, $command_args); +} + + +# Descriptions: change delivery mode from digest to real time. +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: update $member_map +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + my $config = $curproc->config(); + my $cred = $curproc->{ credential }; + my $options = $command_args->{ options }; + my $address = $command_args->{ command_data } || $options->[ 0 ]; + + # XXX We should always add/rewrite only $primary_*_map maps via + # XXX command mail, CUI and GUI. + # XXX Rewriting of maps not $primary_*_map is + # XXX 1) may be not writable. + # XXX 2) ambigous and dangerous + # XXX since the map is under controlled by other module. + # XXX for example, one of member_maps is under admin_member_maps. + my $member_map = $config->{ primary_member_map }; + + # fundamental check + croak("address not defined") unless defined $address; + croak("\$member_map not defined") unless defined $member_map; + croak("address not specified") unless $address; + croak("\$member_map not specified") unless $member_map; + + # FML::User::Control specific parameters + my $uc_args = { + address => $address, + maplist => [ $member_map ], + }; + my $r = ''; + + # diag: $member_map should not have this user. + my $msg_args = { + _arg_address => $address, + }; + if ($cred->has_address_in_map($member_map, $config, $address)) { + my $r = "already member"; + $curproc->reply_message_nl('error.already_member', + $r, + $msg_args); + $curproc->logerror($r); + croak($r); + } + + eval q{ + use FML::User::Control; + my $obj = new FML::User::Control; + $obj->useradd($curproc, $command_args, $uc_args); + }; + if ($r = $@) { + croak($r); + } +} + + +# Descriptions: show cgi menu for on +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: update $member_map +# Return Value: none +sub cgi_menu +{ + my ($self, $curproc, $command_args) = @_; + my $r = ''; + + eval q{ + use FML::CGI::User; + my $obj = new FML::CGI::User; + $obj->cgi_menu($curproc, $command_args); + }; + if ($r = $@) { + croak($r); + } +} + + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2004 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::Admin::addmember first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/Admin/addmembers.pm b/fml/lib/FML/Command/Admin/addmembers.pm new file mode 100644 index 00000000..344db2ca --- /dev/null +++ b/fml/lib/FML/Command/Admin/addmembers.pm @@ -0,0 +1,65 @@ +#-*- perl -*- +# +# Copyright (C) 2004 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: add.pm,v 1.9 2004/01/02 14:42:42 fukachan Exp $ +# + +package FML::Command::Admin::addmembers; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +use FML::Command::Admin::addmember; +@ISA = qw(FML::Command::Admin::addmember); + + +# Descriptions: add user as only member +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: forward request to addmember module +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + $self->SUPER::process($curproc, $command_args); +} + +=head1 NAME + +FML::Command::Admin::add - add a new member (member only) + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +an alias of C<FML::Command::Admin::addmember>. + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2004 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::Admin::add first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/Admin/addrecipient.pm b/fml/lib/FML/Command/Admin/addrecipient.pm new file mode 100644 index 00000000..0afc0054 --- /dev/null +++ b/fml/lib/FML/Command/Admin/addrecipient.pm @@ -0,0 +1,177 @@ +#-*- perl -*- +# +# Copyright (C) 2004 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: on.pm,v 1.19 2004/04/30 13:38:05 fukachan Exp $ +# + +package FML::Command::Admin::addrecipient; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +=head1 NAME + +FML::Command::Admin::addrecipient - add recipient (recipient only) + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +change delivery mode from digest to real time. + +=head1 METHODS + +=head2 process($curproc, $command_args) + +=cut + + +# Descriptions: constructor +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: OBJ +sub new +{ + my ($self) = @_; + my ($type) = ref($self) || $self; + my $me = {}; + return bless $me, $type; +} + + +# Descriptions: need lock or not +# Arguments: none +# Side Effects: none +# Return Value: NUM( 1 or 0) +sub need_lock { 1;} + + +# Descriptions: lock channel +# Arguments: none +# Side Effects: none +# Return Value: STR +sub lock_channel { return 'command_serialize';} + + +# Descriptions: verify the syntax command string. +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: none +# Return Value: NUM(1 or 0) +sub verify_syntax +{ + my ($self, $curproc, $command_args) = @_; + + use FML::Command::Syntax; + push(@ISA, qw(FML::Command::Syntax)); + $self->check_syntax_address_handler($curproc, $command_args); +} + + +# Descriptions: change delivery mode from digest to real time. +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: update $recipient_map +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + my $config = $curproc->config(); + my $cred = $curproc->{ credential }; + my $options = $command_args->{ options }; + my $address = $command_args->{ command_data } || $options->[ 0 ]; + + # XXX We should always add/rewrite only $primary_*_map maps via + # XXX command mail, CUI and GUI. + # XXX Rewriting of maps not $primary_*_map is + # XXX 1) may be not writable. + # XXX 2) ambigous and dangerous + # XXX since the map is under controlled by other module. + # XXX for example, one of member_maps is under admin_member_maps. + my $recipient_map = $config->{ primary_recipient_map }; + + # fundamental check + croak("address not defined") unless defined $address; + croak("\$recipient_map not defined") unless defined $recipient_map; + croak("address not specified") unless $address; + croak("\$recipient_map not specified") unless $recipient_map; + + # FML::User::Control specific parameters + my $uc_args = { + address => $address, + maplist => [ $recipient_map ], + }; + my $r = ''; + + # diag: $recipient_map should not have this user. + my $msg_args = { + _arg_address => $address, + }; + if ($cred->has_address_in_map($recipient_map, $config, $address)) { + my $r = "already recipient"; + $curproc->reply_message_nl('error.already_recipient', + $r, + $msg_args); + $curproc->logerror($r); + croak($r); + } + + eval q{ + use FML::User::Control; + my $obj = new FML::User::Control; + $obj->useradd($curproc, $command_args, $uc_args); + }; + if ($r = $@) { + croak($r); + } +} + + +# Descriptions: show cgi menu for on +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: update $recipient_map +# Return Value: none +sub cgi_menu +{ + my ($self, $curproc, $command_args) = @_; + my $r = ''; + + eval q{ + use FML::CGI::User; + my $obj = new FML::CGI::User; + $obj->cgi_menu($curproc, $command_args); + }; + if ($r = $@) { + croak($r); + } +} + + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2004 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::Admin::addrecipient first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; diff --git a/fml/lib/FML/Command/Admin/addrecipients.pm b/fml/lib/FML/Command/Admin/addrecipients.pm new file mode 100644 index 00000000..14618136 --- /dev/null +++ b/fml/lib/FML/Command/Admin/addrecipients.pm @@ -0,0 +1,65 @@ +#-*- perl -*- +# +# Copyright (C) 2004 Ken'ichi Fukamachi +# All rights reserved. This program is free software; you can +# redistribute it and/or modify it under the same terms as Perl itself. +# +# $FML: add.pm,v 1.9 2004/01/02 14:42:42 fukachan Exp $ +# + +package FML::Command::Admin::addrecipients; +use strict; +use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD); +use Carp; + + +use FML::Command::Admin::addrecipient; +@ISA = qw(FML::Command::Admin::addrecipient); + + +# Descriptions: add user as only recipient +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) +# Side Effects: forward request to addrecipient module +# Return Value: none +sub process +{ + my ($self, $curproc, $command_args) = @_; + $self->SUPER::process($curproc, $command_args); +} + +=head1 NAME + +FML::Command::Admin::add - add a new recipient (recipient only) + +=head1 SYNOPSIS + +See C<FML::Command> for more details. + +=head1 DESCRIPTION + +an alias of C<FML::Command::Admin::addrecipient>. + +=head1 CODING STYLE + +See C<http://www.fml.org/software/FNF/> on fml coding style guide. + +=head1 AUTHOR + +Ken'ichi Fukamachi + +=head1 COPYRIGHT + +Copyright (C) 2004 Ken'ichi Fukamachi + +All rights reserved. This program is free software; you can +redistribute it and/or modify it under the same terms as Perl itself. + +=head1 HISTORY + +FML::Command::Admin::add first appeared in fml8 mailing list driver package. +See C<http://www.fml.org/> for more details. + +=cut + + +1; |
