Changeset 11514 for trunk

Show
Ignore:
Timestamp:
10/20/08 07:23:30 (3 months ago)
Author:
javier.amor.garcia@…
Message:

EBox::MailUserLdap::getUserLdapValue does not longer assumme that the user exists

Location:
trunk/client/mail
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/client/mail/ChangeLog

    r11513 r11514  
    110.12.100 
    2         + EBox::MailUserLdap::userAccount does not longer assumme that the user exists 
     2        + EBox::MailUserLdap::userAccount and  EBox::MailUserLdap::getUserLdapValue  dont longer assumme that the user exists 
    330.12.99 
    44        + Add support for reporting 
  • trunk/client/mail/src/EBox/MailUserLdap.pm

    r11513 r11514  
    234234#               uid - uid of the user 
    235235#               value - the atribute name 
     236# 
     237# Returns:  
     238#    the value of the attribute. Undef if either the user ot the attribute 
     239#    does not exists 
    236240sub getUserLdapValue   #uid, ldap value 
    237241{ 
     
    248252    my $result = $self->{ldap}->search(\%args); 
    249253    my $entry = $result->entry(0); 
     254    if (not defined $entry) { 
     255        EBox::warn("Inexistent user $uid asked for LDAP attribute $value"); 
     256        return undef; 
     257    } 
     258 
    250259     
    251260    return $entry->get_value($value); 
    252261} 
    253262 
     263 
     264# Method: existsUserLdapValue 
     265# 
     266#   checks whether a LDAP attribute exists on a given user 
     267# 
     268# Parameters: 
     269# 
     270#               uid - uid of the user 
     271#               value - the atribute name 
     272#  Returns: 
     273#       true if the user and the LDAP attribute exist.  Undef if either the user ot the attribute 
     274#    does not exists 
    254275sub existsUserLdapValue   
    255276{ 
     
    805826  my $result = $self->{ldap}->search(\%args); 
    806827  my $entry = $result->entry(0); 
     828  if (not defined $entry) { 
     829      EBox::warn("Inexistent user: $username"); 
     830      return (); 
     831  } 
    807832 
    808833  my $mdsize = $entry->get_value('userMaildirSize');