diff options
Diffstat (limited to 'lib/Fripost/Schema')
-rw-r--r-- | lib/Fripost/Schema/Local.pm | 14 | ||||
-rw-r--r-- | lib/Fripost/Schema/User.pm (renamed from lib/Fripost/Schema/Mailbox.pm) | 54 |
2 files changed, 34 insertions, 34 deletions
diff --git a/lib/Fripost/Schema/Local.pm b/lib/Fripost/Schema/Local.pm index 49c3d68..400b4e5 100644 --- a/lib/Fripost/Schema/Local.pm +++ b/lib/Fripost/Schema/Local.pm @@ -7,7 +7,7 @@ Local.pm - =head1 DESCRIPTION Local.pm abstracts the LDAP schema definition and provides methods to -search for virtual mailboxes, aliases or lists alltogether. +search for virtual users, aliases or lists alltogether. =cut @@ -29,7 +29,7 @@ use Net::IDN::Encode qw/email_to_ascii email_to_unicode/; Returns a hash with all the (visible) attributes for the given entry. An additional 'type' attribute gives the type of *the* found entry -(possible values are 'mailbox', 'alias', and 'list'). +(possible values are 'user', 'alias', and 'list'). =cut @@ -44,14 +44,14 @@ sub get { base => "fvd=$d,".$self->suffix, scope => 'one', deref => 'never', - filter => "(|(&(objectClass=FripostVirtualMailbox)(fvu=$l)) + filter => "(|(&(objectClass=FripostVirtualUser)(fvu=$l)) (&(objectClass=FripostVirtualAlias)(fva=$l)) (&(objectClass=FripostVirtualList)(fvl=$l)))", attrs => [ qw/fvu description fripostIsStatusActive fripostIsStatusPending fripostOptionalMaildrop - fripostMailboxQuota + fripostUserQuota fva fripostMaildrop fvl fripostListManager/ ] ); @@ -62,7 +62,7 @@ sub get { # The following is not supposed to happen. Note that there is # nothing in the LDAP schema to prevent that, but it's not too - # critical as Postfix search for mailboxes, aliases and lists in + # critical as Postfix searchs for user, aliases and lists in # that order. die "Error: Multiple matching entries found." if $locals->count > 1; my $local = $locals->pop_entry; @@ -74,7 +74,7 @@ sub get { my %ret; if ($local->dn =~ /^fvu=/) { - $ret{type} = 'mailbox'; + $ret{type} = 'user'; $ret{user} = $local->get_value('fvu'); $ret{forwards} = concat($concat, map { email_to_unicode($_) } $local->get_value('fripostOptionalMaildrop')) @@ -113,7 +113,7 @@ sub exists { # We may not have read access to the list commands # The trick is somewhat dirty, but it's safe enough since postfix - # delivers to mailboxes, aliases, and lists with different + # delivers to users, aliases, and lists with different # priorities (and lists have the lowest). my @cmds = qw/admin bounces confirm join leave owner request subscribe unsubscribe bounce sendkey/; my @tests = ( 'fvu='.$l, 'fva='.$l, 'fvl='.$l ); diff --git a/lib/Fripost/Schema/Mailbox.pm b/lib/Fripost/Schema/User.pm index ce23d98..11f5e28 100644 --- a/lib/Fripost/Schema/Mailbox.pm +++ b/lib/Fripost/Schema/User.pm @@ -1,13 +1,13 @@ -package Fripost::Schema::Mailbox; +package Fripost::Schema::User; =head1 NAME -Mailbox.pm - +User.pm - =head1 DESCRIPTION -Mailbox.pm abstracts the LDAP schema definition and provides methods to -add, list or delete virtual mailboxes. +User.pm abstracts the LDAP schema definition and provides methods to +add, list or delete virtual users. =cut @@ -28,8 +28,8 @@ use Net::IDN::Encode qw/domain_to_ascii =item B<search> (I<domain>, I<OPTIONS>) -List every known (and visible) mailbox under the given domain. The -output is a array of hash references, sorted by mailbox. +List every known (and visible) user under the given domain. The +output is a array of hash references, sorted by user. =cut @@ -39,32 +39,32 @@ sub search { my %options = @_; my $concat = $options{'-concat'}; - my $mailboxes = $self->ldap->search( - base => "fvd=$d,".$self->suffix, - scope => 'one', - deref => 'never', - filter => 'objectClass=FripostVirtualMailbox', - attrs => [ qw/fvu description fripostIsStatusActive - fripostOptionalMaildrop - fripostMailboxQuota/ ] - ); - if ($mailboxes->code) { + my $users = $self->ldap->search( + base => "fvd=$d,".$self->suffix, + scope => 'one', + deref => 'never', + filter => 'objectClass=FripostVirtualUser', + attrs => [ qw/fvu description fripostIsStatusActive + fripostOptionalMaildrop + fripostUserQuota/ ] + ); + if ($users->code) { die $options{'-die'}."\n" if defined $options{'-die'}; - die $mailboxes->error."\n"; + die $users->error."\n"; } return map { { user => email_to_unicode($_->get_value('fvu')) , isactive => $_->get_value('fripostIsStatusActive') eq 'TRUE' , description => concat($concat, $_->get_value('description')) , forwards => concat($concat, map { email_to_unicode($_) } $_->get_value('fripostOptionalMaildrop')) - , quota => $_->get_value('fripostMailboxQuota') // undef + , quota => $_->get_value('fripostUserQuota') // undef } } - $mailboxes->sorted('fvu') + $users->sorted('fvu') } -=item B<replace> (I<mailbox>, I<OPTIONS>) +=item B<replace> (I<user>, I<OPTIONS>) Replace an existing account with the given one. @@ -117,7 +117,7 @@ sub passwd { -=item B<add> (I<mailbox>, I<OPTIONS>) +=item B<add> (I<user>, I<OPTIONS>) Add the given account. @@ -140,13 +140,13 @@ sub add { die "‘".$m->{user}."’ already exists\n" if $self->local->exists($m->{user},%options); - my %attrs = ( objectClass => 'FripostVirtualMailbox' + my %attrs = ( objectClass => 'FripostVirtualUser' , fripostIsStatusActive => $m->{isactive} ? 'TRUE' : 'FALSE' , userPassword => $m->{password} ); $attrs{description} = $m->{description} if defined $m->{description} and @{$m->{description}}; - $attrs{fripostMailboxQuota} = $m->{quota} if defined $m->{quota}; + $attrs{fripostUserQuota} = $m->{quota} if defined $m->{quota}; $attrs{fripostOptionalMaildrop} = $m->{forwards} if defined $m->{forwards} and @{$m->{forwards}}; @@ -161,10 +161,10 @@ sub add { } -=item B<delete> (I<mailbox>, I<OPTIONS>) +=item B<delete> (I<user>, I<OPTIONS>) -Delete the given mailbox. Note: this will NOT wipe the mailbox off the -disk, but merely delete its entry in the LDAP directory. +Delete the given user. Note: this will NOT wipe the user off the disk, +but merely delete its entry in the LDAP directory. =cut @@ -197,7 +197,7 @@ The B<-die> option, if present, overides LDAP croaks and errors. =cut -# Ensure that the given mailbox is valid. +# Ensure that the given user is valid. sub _is_valid { my $m = shift; must_attrs( $m, qw/user isactive/ ); |