aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@fripost.org>2013-01-17 20:46:12 +0100
committerGuilhem Moulin <guilhem.moulin@fripost.org>2013-01-17 20:46:12 +0100
commit58bf9c43bf20c060a9e0623cb9f032b63889b384 (patch)
tree1f7f6d0eac03aaf10222d92ba633a176ecc29c02
parent4091fbbb0b280120407e0625dd49e741e481a528 (diff)
Mailbox → User.
-rw-r--r--css/style.css2
-rw-r--r--lib/Fripost/Panel/Interface.pm45
-rw-r--r--lib/Fripost/Schema.pm14
-rw-r--r--lib/Fripost/Schema/Local.pm14
-rw-r--r--lib/Fripost/Schema/User.pm (renamed from lib/Fripost/Schema/Mailbox.pm)54
-rw-r--r--template/add-user.html (renamed from template/add-mailbox.html)8
-rw-r--r--template/edit-domain.html4
-rw-r--r--template/edit-user.html (renamed from template/edit-mailbox.html)8
-rw-r--r--template/list-locals.html12
9 files changed, 80 insertions, 81 deletions
diff --git a/css/style.css b/css/style.css
index 493856a..1021403 100644
--- a/css/style.css
+++ b/css/style.css
@@ -22,7 +22,7 @@ body {
h1, h2, h3 {
margin: 15pt auto 10pt auto;
}
-span.domain, span.email, span.alias, span.mailbox, span.list {
+span.domain, span.email, span.alias, span.user, span.list {
font-family: Inconsolata, "Lucida Console", "Droid Sans Mono", Cousine, monospace;
}
.errorhttp {
diff --git a/lib/Fripost/Panel/Interface.pm b/lib/Fripost/Panel/Interface.pm
index 4e5b48e..02f3f4b 100644
--- a/lib/Fripost/Panel/Interface.pm
+++ b/lib/Fripost/Panel/Interface.pm
@@ -55,7 +55,7 @@ sub ListDomains : StartRunmode {
}
-# This Run Mode lists the known mailboxes, aliases and lists under the current
+# This Run Mode lists the known users, aliases and lists under the current
# domain.
sub ListLocals : Runmode {
my $self = shift;
@@ -68,12 +68,11 @@ sub ListLocals : Runmode {
# Query *the* matching domain
my %domain = $fp->domain->get( $d, -die => 404 );
- # Query the mailboxes, aliases and lists under the given domain. We
- # don't die with a HTTP error code here, as it is not supposed to
- # crash.
- my @mailboxes = $fp->mailbox->search( $d );
- my @aliases = $fp->alias->search( $d );
- my @lists = $fp->list->search( $d );
+ # Query the users, aliases and lists under the given domain. We don't
+ # die with a HTTP error code here, as it is not supposed to crash.
+ my @users = $fp->user->search( $d );
+ my @aliases = $fp->alias->search( $d );
+ my @lists = $fp->list->search( $d );
$fp->done;
@@ -88,12 +87,12 @@ sub ListLocals : Runmode {
# activation, modify catchalls?)
$template->param( canEditDomain => $domain{permissions} =~ /[op]/ );
- # Can the user add mailboxes?
- $template->param( canAddMailbox => $domain{permissions} =~ /p/ );
- # Should we list mailboxes?
- $template->param( listMailboxes => $#mailboxes >= 0 ||
+ # Can the user add users?
+ $template->param( canAddUser => $domain{permissions} =~ /p/ );
+ # Should we list users?
+ $template->param( listUsers => $#users >= 0 ||
$domain{permissions} =~ /p/ );
- $template->param( mailboxes => [
+ $template->param( users => [
map { { &mkLink(user => $_->{user})
, description => join ("\n", @{$_->{description}})
, isactive => $_->{isactive}
@@ -102,7 +101,7 @@ sub ListLocals : Runmode {
, quota => $_->{quota}
};
}
- @mailboxes
+ @users
]);
# Can the user add aliases?
@@ -217,12 +216,12 @@ sub EditLocal : Runmode {
my $fp = Fripost::Schema::->SASLauth( $self->authen->username, %CFG );
- # Search for *the* matching mailbox, alias or list.
+ # Search for *the* matching user, alias or list.
my ($d,$l) = ($self->split_path)[1,2];
my %local = $fp->local->get ($l.'@'.$d, -die => 404,
-concat => "\x{0D}\x{0A}" );
die "Unknown type" unless grep { $local{type} eq $_ }
- qw/mailbox alias list/;
+ qw/user alias list/;
die "404\n" if $local{ispending};
my $error; # Tells whether the change submission has failed.
@@ -239,7 +238,7 @@ sub EditLocal : Runmode {
if (defined $q->param('submit')) {
# Changes have been submitted: process them
my %entry;
- if ($t eq 'mailbox') {
+ if ($t eq 'user') {
$entry{user} = $l.'@'.$d;
$entry{forwards} = $q->param('forwards');
@@ -268,7 +267,7 @@ sub EditLocal : Runmode {
ldap_suffix => $CFG{ldap_suffix},
-die => "Wrong password (for ‘".$u."’)." );
};
- $error = $@ || $fp->mailbox->passwd(
+ $error = $@ || $fp->user->passwd(
$entry{user},
Fripost::Password::hash($q->param('newpw'))
);
@@ -296,7 +295,7 @@ sub EditLocal : Runmode {
if ($error and defined $q->param('submit')) {
# Preserve the (incorrect) form, except the passwords
- if ($t eq 'mailbox') {
+ if ($t eq 'user') {
$template->param( user => encode_entities($l)
, forwards => $q->param('forwards') );
}
@@ -313,7 +312,7 @@ sub EditLocal : Runmode {
else {
%local = $fp->local->get ($l.'@'.$d, -die => 404,
-concat => "\x{0D}\x{0A}" );
- if ($t eq 'mailbox') {
+ if ($t eq 'user') {
$template->param( user => encode_entities($local{user})
, forwards => encode_entities($local{forwards}) );
}
@@ -341,8 +340,8 @@ sub EditLocal : Runmode {
}
-# In this Run Mode authenticated users can add mailboxes, aliases and
-# lists (if they have the permission).
+# In this Run Mode authenticated users can add users, aliases and lists
+# (if they have the permission).
sub AddLocal : Runmode {
my $self = shift;
my %CFG = $self->cfg;
@@ -357,7 +356,7 @@ sub AddLocal : Runmode {
# Changes have been submitted: process them
my %entry;
my %rest;
- if ($t eq 'mailbox') {
+ if ($t eq 'user') {
$entry{user} = $q->param('user').'@'.$d;
$entry{forwards} = $q->param('forwards');
if ($q->param('password') ne $q->param('password2')) {
@@ -417,7 +416,7 @@ sub AddLocal : Runmode {
$template->param( domain => encode_entities($d) );
if ($error) {
# Preserve the (incorrect) form, except the passwords
- if ($t eq 'mailbox') {
+ if ($t eq 'user') {
$template->param( user => $q->param('user')
, forwards => $q->param('forwards') );
}
diff --git a/lib/Fripost/Schema.pm b/lib/Fripost/Schema.pm
index ad88c82..909a92c 100644
--- a/lib/Fripost/Schema.pm
+++ b/lib/Fripost/Schema.pm
@@ -9,7 +9,7 @@ Schema.pm -
=head1 DESCRIPTION
Schema.pm abstracts the LDAP schema definition and provides methods to
-add, list or delete virtual domains, mailboxes, aliases or lists.
+add, list or delete virtual domains, users, aliases or lists.
=cut
@@ -21,7 +21,7 @@ use utf8;
use Net::LDAP;
use Authen::SASL 'Cyrus';
use Fripost::Schema::Domain;
-use Fripost::Schema::Mailbox;
+use Fripost::Schema::User;
use Fripost::Schema::Alias;
use Fripost::Schema::List;
use Fripost::Schema::Local;
@@ -141,14 +141,14 @@ domain-specific methods.
sub domain { bless shift, 'Fripost::Schema::Domain'; }
-=item B<mailbox>
+=item B<user>
-Bless the object to C<Fripost::Schema::Mailbox>, to access
-mailbox-specific methods.
+Bless the object to C<Fripost::Schema::User>, to access
+user-specific methods.
=cut
-sub mailbox { bless shift, 'Fripost::Schema::Mailbox'; }
+sub user { bless shift, 'Fripost::Schema::User'; }
=item B<alias>
@@ -174,7 +174,7 @@ sub list { bless shift, 'Fripost::Schema::List'; }
=item B<local>
Bless the object to C<Fripost::Schema::Local>, to access
-local-specific (mailboxes, aliases and lists) methods.
+local-specific (users, aliases and lists) methods.
=cut
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/ );
diff --git a/template/add-mailbox.html b/template/add-user.html
index 7fc2239..e46c16a 100644
--- a/template/add-mailbox.html
+++ b/template/add-user.html
@@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>Add mailbox under <TMPL_VAR NAME=domain></title>
+ <title>Add user under <TMPL_VAR NAME=domain></title>
<link href="/css/style.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
@@ -21,7 +21,7 @@
<hr/>
<div id="content">
- <h1>Add mailbox under <span class="domain"><TMPL_VAR NAME=domain></span></h1>
+ <h1>Add user under <span class="domain"><TMPL_VAR NAME=domain></span></h1>
<TMPL_IF NAME=error>
<div class="fail">Error: <TMPL_VAR NAME=error></div>
@@ -34,7 +34,7 @@
<form class="editform" name="editform" method="post" action="?">
<div class="editform">
<input type="hidden" name="a" value="add" />
- <input type="hidden" name="t" value="mailbox" />
+ <input type="hidden" name="t" value="user" />
<h4 class="label">User name</h4>
<input type="text" name="user" size="15" value="<TMPL_VAR NAME=user>"/>@<TMPL_VAR NAME=domain>
@@ -79,7 +79,7 @@
<textarea name="forwards" cols="50" rows="5" ><TMPL_VAR NAME=forwards></textarea>
<div class="help">
An optional list of destinations (one e-mail address per line) that
- will <i>also</i> receive mail delivered to this mailbox.
+ will <i>also</i> receive mail delivered to this user.
</div>
<hr/>
diff --git a/template/edit-domain.html b/template/edit-domain.html
index a8af3fb..dbbdf3c 100644
--- a/template/edit-domain.html
+++ b/template/edit-domain.html
@@ -45,8 +45,8 @@
<option value="0" <TMPL_UNLESS NAME=isactive>selected="selected"</TMPL_UNLESS>>Inactive</option>
</select>
<div class="help">
- <b>Warning</b>: emails are <i>not</i> delivered to mailboxes,
- aliases or lists of inactive domains.
+ <b>Warning</b>: emails are <i>not</i> delivered to users,
+ aliases or lists under inactive domains.
</div>
<hr/>
diff --git a/template/edit-mailbox.html b/template/edit-user.html
index 41fcf45..7b61a51 100644
--- a/template/edit-mailbox.html
+++ b/template/edit-user.html
@@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <title>Edit mailbox <TMPL_VAR NAME=user>@<TMPL_VAR NAME=domain></title>
+ <title>Edit user <TMPL_VAR NAME=user>@<TMPL_VAR NAME=domain></title>
<link href="/css/style.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
@@ -22,7 +22,7 @@
<hr/>
<div id="content">
- <h1>Edit mailbox <span class="mailbox"><TMPL_VAR NAME=user>@<TMPL_VAR NAME=domain></span></h1>
+ <h1>Edit user <span class="user"><TMPL_VAR NAME=user>@<TMPL_VAR NAME=domain></span></h1>
<TMPL_IF NAME=newChanges>
@@ -72,7 +72,7 @@
<div class="help">
<i>Note</i>:
You need to enter your
- (<span class="mailbox"><TMPL_VAR NAME=user_localpart>@<TMPL_VAR NAME=user_domainpart></span>'s)
+ (<span class="user"><TMPL_VAR NAME=user_localpart>@<TMPL_VAR NAME=user_domainpart></span>'s)
current password first.
Leave these fields empty if you do not want to change the
password.
@@ -95,7 +95,7 @@
will receive mail for
<span class="email"><TMPL_VAR NAME=user>@<TMPL_VAR NAME=domain></span>.
(<i>Note</i>: When not empty, this list cancels delivery to
- this mailbox, so do not forget to list
+ this user, so do not forget to list
<span class="email"><TMPL_VAR NAME=user>@<TMPL_VAR NAME=domain></span>
here as well if you want this mailbox to be delivered too.)
</div>
diff --git a/template/list-locals.html b/template/list-locals.html
index afff04a..4f21ee8 100644
--- a/template/list-locals.html
+++ b/template/list-locals.html
@@ -34,12 +34,12 @@
</p>
- <TMPL_IF NAME=listMailboxes>
- <h3>Mailboxes<TMPL_IF NAME=canAddMailbox
- ><span class="action">[<a href="./?a=add&amp;t=mailbox">add</a>]</span
+ <TMPL_IF NAME=listUsers>
+ <h3>Users<TMPL_IF NAME=canAddUser
+ ><span class="action">[<a href="./?a=add&amp;t=user">add</a>]</span
></TMPL_IF></h3>
- <table class="list" id="mailboxes">
+ <table class="list" id="users">
<thead>
<tr class="odd">
<th>Account</th>
@@ -50,9 +50,9 @@
</tr>
</thead>
<tbody>
- <TMPL_LOOP NAME=mailboxes>
+ <TMPL_LOOP NAME=users>
<TMPL_IF NAME=__even__><tr class="odd"><TMPL_ELSE><tr></TMPL_IF>
- <td><span class="mailbox"><a href="<TMPL_VAR NAME=userURI>/"><TMPL_VAR NAME=user></a></span></td>
+ <td><span class="user"><a href="<TMPL_VAR NAME=userURI>/"><TMPL_VAR NAME=user></a></span></td>
<td><TMPL_IF NAME=description><TMPL_VAR NAME=description><TMPL_ELSE><span class="none">(none)</span></TMPL_IF></td>
<td><TMPL_IF NAME=isactive><span class="active">&#x2714;</span><TMPL_ELSE><span class="inactive">&#x2718;</span></TMPL_IF></td>
<td><TMPL_UNLESS NAME=forwards><span class="none">(none)</span></TMPL_UNLESS>