aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Fripost/Schema
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Fripost/Schema')
-rw-r--r--lib/Fripost/Schema/Domain.pm20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/Fripost/Schema/Domain.pm b/lib/Fripost/Schema/Domain.pm
index 64a8932..80810e5 100644
--- a/lib/Fripost/Schema/Domain.pm
+++ b/lib/Fripost/Schema/Domain.pm
@@ -100,9 +100,13 @@ sub get {
return ( domain => domain_to_unicode($domain->get_value('fvd'))
, isactive => $domain->get_value('fripostIsStatusActive') eq 'TRUE'
, description => concat($concat, $domain->get_value('description'))
- , catchalls => concat($concat, map { _email_to_unicode ($_) }
+ , catchalls => concat($concat, map { &_email_to_unicode ($_) }
$domain->get_value('fripostOptionalMaildrop'))
, permissions => get_perms($domain, $self->whoami)
+ , canCreateAlias => concat($concat, map { &_email_to_unicode ($self->_dn2email($_)) }
+ $domain->get_value('fripostCanCreateAlias'))
+ , canCreateList => concat($concat, map { &_email_to_unicode ($self->_dn2email($_)) }
+ $domain->get_value('fripostCanCreateList'))
)
}
@@ -118,7 +122,7 @@ sub replace {
my $d = shift;
my %options = @_;
- foreach (qw/description catchalls/) {
+ foreach (qw/description catchalls canCreateAlias canCreateList/) {
$d->{$_} = explode ($options{'-concat'}, $d->{$_})
if defined $d->{$_};
}
@@ -131,6 +135,12 @@ sub replace {
'TRUE' : 'FALSE'
, description => $d->{description}
, fripostOptionalMaildrop => $d->{catchalls}
+ , fripostCanCreateAlias =>
+ [ map $self->_email2dn($_),
+ @{$d->{canCreateAlias}} ]
+ , fripostCanCreateList =>
+ [ map $self->_email2dn($_),
+ @{$d->{canCreateList}} ]
} );
die $mesg->error."\n" if $mesg->code;
};
@@ -165,10 +175,14 @@ sub _is_valid {
-exact => 1 );
$d->{catchalls} = [ map { email_valid($_, -prefix => 'fake') }
@{$d->{catchalls}} ];
+ $d->{canCreateAlias} = [ map { email_valid($_, -prefix => 'fake') }
+ @{$d->{canCreateAlias}} ];
+ $d->{canCreateList} = [ map { email_valid($_, -prefix => 'fake') }
+ @{$d->{canCreateList}} ];
}
-# A variante of email_to_unicode that also takes care of domain aliases.
+# A variant of email_to_unicode that also takes care of domain aliases.
sub _email_to_unicode {
my $email = shift;
return '@'.domain_to_unicode($email) if $email =~ s/^\@//;