diff options
author | Guilhem Moulin <guilhem.moulin@fripost.org> | 2012-09-29 21:17:15 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem.moulin@fripost.org> | 2012-09-29 21:17:15 +0200 |
commit | a4fb637c441cad75350edcbbb2520f7a303b33c2 (patch) | |
tree | 7761e4104a6c3cb64b0930293bc2a748e0c52c11 /lib/Fripost/Schema | |
parent | 58825808fb1fd2d9950e8f7a81ad62db18be4aa7 (diff) |
Grant the right to create aliases and/or lists.
Diffstat (limited to 'lib/Fripost/Schema')
-rw-r--r-- | lib/Fripost/Schema/Domain.pm | 20 |
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/^\@//; |