diff options
author | Guilhem Moulin <guilhem.moulin@fripost.org> | 2012-09-09 23:34:54 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem.moulin@fripost.org> | 2012-09-09 23:34:54 +0200 |
commit | 62f0ac114989808ebb84e7728b4b7e9f65d53c0e (patch) | |
tree | 52d70e2bbff7c37eaabe625186444e26dd0feadc /lib/Fripost/Schema | |
parent | ec17f0ce71a233025768a54b4a1beae34e2b8a45 (diff) |
Added delete links.
Diffstat (limited to 'lib/Fripost/Schema')
-rw-r--r-- | lib/Fripost/Schema/Alias.pm | 24 | ||||
-rw-r--r-- | lib/Fripost/Schema/List.pm | 23 | ||||
-rw-r--r-- | lib/Fripost/Schema/Mailbox.pm | 24 |
3 files changed, 71 insertions, 0 deletions
diff --git a/lib/Fripost/Schema/Alias.pm b/lib/Fripost/Schema/Alias.pm index c413257..0976093 100644 --- a/lib/Fripost/Schema/Alias.pm +++ b/lib/Fripost/Schema/Alias.pm @@ -134,6 +134,30 @@ sub add { return $@; } + +=item B<delete> (I<alias>, I<domain>, I<OPTIONS>) + +Delete the given alias. + +=cut + +sub delete { + my $self = shift; + my $l = shift; + my $d = shift; + my %options = @_; + + my $mesg = $self->ldap->delete( "fva=$l,fvd=$d,".$self->suffix ); + if ($mesg->code) { + if (defined $options{'-die'}) { + return $mesg->error unless $options{'-die'}; + die $options{'-die'}."\n"; + } + die $mesg->error; + } +} + + =back =head1 GLOBAL OPTIONS diff --git a/lib/Fripost/Schema/List.pm b/lib/Fripost/Schema/List.pm index ad0902d..ec66f76 100644 --- a/lib/Fripost/Schema/List.pm +++ b/lib/Fripost/Schema/List.pm @@ -143,6 +143,29 @@ sub add { } +=item B<delete> (I<list>, I<domain>, I<OPTIONS>) + +Delete the given list. Note: this will NOT wipe the archives off the +disk, but merely delete the list entry in the LDAP directory. + +=cut + +sub delete { + my $self = shift; + my $l = shift; + my $d = shift; + my %options = @_; + + my $mesg = $self->ldap->delete( "fvl=$l,fvd=$d,".$self->suffix ); + if ($mesg->code) { + if (defined $options{'-die'}) { + return $mesg->error unless $options{'-die'}; + die $options{'-die'}."\n"; + } + die $mesg->error; + } +} + =back diff --git a/lib/Fripost/Schema/Mailbox.pm b/lib/Fripost/Schema/Mailbox.pm index a3ae4be..28ef376 100644 --- a/lib/Fripost/Schema/Mailbox.pm +++ b/lib/Fripost/Schema/Mailbox.pm @@ -160,6 +160,30 @@ sub add { } +=item B<delete> (I<mailbox>, I<domain>, 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. + +=cut + +sub delete { + my $self = shift; + my $l = shift; + my $d = shift; + my %options = @_; + + my $mesg = $self->ldap->delete( "fvu=$l,fvd=$d,".$self->suffix ); + if ($mesg->code) { + if (defined $options{'-die'}) { + return $mesg->error unless $options{'-die'}; + die $options{'-die'}."\n"; + } + die $mesg->error; + } +} + + =back =head1 GLOBAL OPTIONS |