]> err.no Git - scalable-opengroupware.org/blobdiff - SoObjects/SOGo/SOGoAuthenticator.m
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1052 d1b88da0-ebda-0310...
[scalable-opengroupware.org] / SoObjects / SOGo / SOGoAuthenticator.m
index 18c00d2728d4cc63df332e11e240009338128dd1..134dba0235f104ae0eef91ddfd45e4583481b28e 100644 (file)
 #import <NGLdap/NGLdapConnection.h>
 #import "SOGoPermissions.h"
 
-#include "SOGoAuthenticator.h"
-#include "SOGoUser.h"
-#include "common.h"
+#import "LDAPUserManager.h"
+
+#import "SOGoAuthenticator.h"
+#import "SOGoUser.h"
+#import "common.h"
 
 @implementation SOGoAuthenticator
 
@@ -50,9 +52,9 @@ static SOGoAuthenticator *auth = nil;
       authMethod = [[ud stringForKey:@"AuthentificationMethod"] retain];
       if ([authMethod isEqualToString: @"LDAP"])
        {
-         LDAPBaseDN = [[ud stringForKey:@"LDAPRootDN"] retain];
-         LDAPHost = [[ud stringForKey:@"LDAPHost"] retain];
-         LDAPPort = [ud integerForKey:@"LDAPPort"];
+//       LDAPBaseDN = [[ud stringForKey:@"LDAPRootDN"] retain];
+//       LDAPHost = [[ud stringForKey:@"LDAPHost"] retain];
+//       LDAPPort = [ud integerForKey:@"LDAPPort"];
        }
     }
 
@@ -87,25 +89,25 @@ static SOGoAuthenticator *auth = nil;
 - (BOOL) LDAPCheckLogin: (NSString *) _login
               password: (NSString *) _pwd
 {
-  return [NGLdapConnection checkPassword: _pwd
-                          ofLogin: _login
-                          atBaseDN: LDAPBaseDN
-                          onHost: LDAPHost
-                          port: LDAPPort];
+  LDAPUserManager *um;
+
+  um = [LDAPUserManager sharedUserManager];
+
+  return [um checkLogin: _login andPassword: _pwd];
 }
 
 /* create SOGoUser */
 
-- (SoUser *) userInContext:(WOContext *)_ctx
+- (SOGoUser *) userInContext: (WOContext *)_ctx
 {
-  static SoUser *anonymous = nil, *freebusy;
-  SoUser *user;
+  static SOGoUser *anonymous = nil, *freebusy;
+  SOGoUser *user;
   NSArray *traversalPath;
   NSString *login;
 
   if (!anonymous)
     anonymous
-      = [[SOGoUser alloc] initWithLogin:@"anonymous"
+      = [[SOGoUser alloc] initWithLogin: @"anonymous"
                          roles: [NSArray arrayWithObject: SoRole_Anonymous]];
   if (!freebusy)
     freebusy
@@ -124,9 +126,8 @@ static SOGoAuthenticator *auth = nil;
             user = anonymous;
         }
       else
-        user = [[[SOGoUser alloc] initWithLogin: login
-                                  roles: [self rolesForLogin: login]]
-                 autorelease];
+        user = [SOGoUser userWithLogin: login
+                        roles: [self rolesForLogin: login]];
     }
   else
     user = nil;