Commits

Zhang Huangbin committed b94c31f

Fix typo and decorator.

Comments (0)

Files changed (3)

controllers/ldap/user.py

         if self.profile_type not in attrs.USER_PROFILE_TYPE:
             web.seeother('/users/%s?msg=INVALID_PROFILE_TYPE&profile_type=%s' % (self.domain, self.profile_type) )
 
-        self.user_profile = userLib.profile(mail=self.mail)
+        self.user_profile = userLib.profile(domain=self.domain, mail=self.mail)
         if self.user_profile[0] is True:
             return render.user_profile(
                     profile_type=self.profile_type,

libs/ldaplib/iredldif.py

         enabledService=['mail'], ):
     domain = web.safestr(domain).lower()
     ldif = [
-            ('objectCLass',     ['mailDomain']),
+            ('objectClass',     ['mailDomain']),
             ('domainName',      [domain]),
             ('mtaTransport',    [mtaTransport]),
             ('accountStatus',   ['active']),
     mail = web.safestr(mail)
 
     ldif = [
-            ('objectCLass',     ['mailAdmin']),
+            ('objectClass',     ['mailAdmin']),
             ('mail',            [mail]),
             ('userPassword',    [str(passwd)]),
             ('accountStatus',   ['active']),
     homeDirectory = storageBaseDirectory + '/' + mailMessageStore
 
     ldif = [
-        ('objectCLass',         ['inetOrgPerson', 'mailUser', 'shadowAccount']),
+        ('objectClass',         ['inetOrgPerson', 'mailUser', 'shadowAccount']),
         ('mail',                [mail]),
         ('userPassword',        [str(passwd)]),
         ('mailQuota',           [str(quota)]),
 
     # Get values of user dn.
     @LDAPDecorators.check_domain_access
-    def profile(self, mail):
+    def profile(self, domain, mail):
         self.mail = web.safestr(mail)
         self.dn = ldaputils.convEmailToUserDN(self.mail)
         try:
             self.user_profile = self.conn.search_s(
                     self.dn,
                     ldap.SCOPE_BASE,
-                    '(objectClass=mailUser)',
+                    '(&(objectClass=mailUser)(%s))' % self.mail,
                     attrs.USER_ATTRS_ALL,
                     )
             return (True, self.user_profile)