Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed MailboxRelated stuff. Better mail in use check #1093

Merged
merged 12 commits into from Mar 12, 2014
1 change: 1 addition & 0 deletions main/mail/ChangeLog
@@ -1,4 +1,5 @@
3.4
+ Added and used checkMailNotInUse method
+ Added _delVDomainAbort to LdapVDomain base to give the
opportunity to abort vdomain removals
+ Use service instead of deprecated invoke-rc.d for init.d scripts
Expand Down
5 changes: 0 additions & 5 deletions main/mail/schemas/eboxmailrelated.ldif

This file was deleted.

2 changes: 1 addition & 1 deletion main/mail/src/EBox/Mail.pm
Expand Up @@ -1849,7 +1849,7 @@ sub checkMailNotInUse
# TODO: check vdomain alias mapping to the other domains?
$self->global()->modInstance('users')->checkMailNotInUse($mail);

# if the external aliases has been already saved to LDAP it will be caught
# if the external aliases has been already saved to LDAP it will be caught
# by the previous check
if ($self->model('ExternalAliases')->aliasInUse($mail)) {
throw EBox::Exceptions::External(
Expand Down
78 changes: 0 additions & 78 deletions main/mail/src/EBox/MailAliasLdap.pm
Expand Up @@ -147,76 +147,6 @@ sub addGroupAlias
$self->addMaildrop($alias, $mail);
}
}

$self->_addmailboxRelatedObject($alias, $group);
}

sub _addmailboxRelatedObject
{
my ($self, $alias, $group) = @_;

return if $self->_mailboxRelatedObjectInGroup($group);

$group->add('objectClass', 'mailboxRelatedObject', 1);
my @currentMail = $group->get('mail');
if (not grep { $_ eq $alias } @currentMail) {
$group->add('mail', $alias, 1) ;
}

$group->save();
}

sub _delmailboxRelatedObject
{
my ($self, $alias, $group) = @_;

return unless $self->_mailboxRelatedObjectExists($alias);

my @classes = $group->get('objectClass');
my @mail = $group->get('mail');

@classes = grep { $_ ne 'mailboxRelatedObject' } @classes;
@mail = grep { $_ ne $alias } @mail;

$group->set('objectClass', \@classes, 1);
$group->set('mail', \@mail, 1);
$group->save();
}

sub _mailboxRelatedObjectInGroup
{
my ($self, $group) = @_;

my $users = EBox::Global->modInstance('users');

$group = $group->get('cn');
my %attrs = (
base => $users->ldap()->dn(),
filter => "(&(objectclass=mailboxRelatedObject)(cn=$group))",
scope => 'sub'
);

my $result = $self->{'ldap'}->search(\%attrs);
my $entry = $result->entry(0);

return $entry->get_value('mail') if ($result->count() != 0);
}

sub _mailboxRelatedObjectExists
{
my ($self, $alias) = @_;

my $users = EBox::Global->modInstance('users');

my %attrs = (
base => $users->ldap()->dn(),
filter => "(&(objectclass=mailboxRelatedObject)(mail=$alias))",
scope => 'sub'
);

my $result = $self->{'ldap'}->search(\%attrs);

return ($result->count > 0);
}

# Method: addVDomainALias
Expand Down Expand Up @@ -467,14 +397,6 @@ sub delGroupAlias
my ($self, $alias, $group) = @_;

$self->delAlias($alias);

$self->_delmailboxRelatedObject($alias, $group);

my @aliases = @{$self->groupAliases($group)};
if (@aliases and not $self->_mailboxRelatedObjectInGroup($group)) {
$alias = shift @aliases;
$self->_addmailboxRelatedObject($alias, $group);
}
}

# Method: delAliasesFromVDomain
Expand Down
1 change: 0 additions & 1 deletion main/mail/src/EBox/MailUserLdap.pm
Expand Up @@ -808,7 +808,6 @@ sub schemas
EBox::Config::share() . '/zentyal-mail/authldap.ldif',
EBox::Config::share() . '/zentyal-mail/eboxmail.ldif',
EBox::Config::share() . '/zentyal-mail/eboxfetchmail.ldif',
EBox::Config::share() . '/zentyal-mail/eboxmailrelated.ldif',
];
}

Expand Down
1 change: 1 addition & 0 deletions main/users/ChangeLog
@@ -1,4 +1,5 @@
3.4
+ Added and used checkMailNotInUse method
+ Updated EBox::Users::Model::Password to use
EBox::Usercorner::updateSessionPassword method and the new samba
location
Expand Down