From: helge Date: Thu, 21 Jul 2005 11:35:20 +0000 (+0000) Subject: improved SoUser lookup X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa69970554980d36a2acfe737e3ac6ea8936c5f5;p=sope improved SoUser lookup git-svn-id: http://svn.opengroupware.org/SOPE/trunk@930 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index f88af476..df79cdfe 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,9 @@ +2005-07-21 Helge Hess + + * SoObjects/WOContext+SoObjects.m: lookup SoUser using authenticator in + case a clientObject is available and it wasn't set yet (when + retrieving the user using -activeUser) (v4.5.178) + 2005-07-20 Marcus Mueller * v4.5.177 diff --git a/sope-appserver/NGObjWeb/SoObjects/WOContext+SoObjects.m b/sope-appserver/NGObjWeb/SoObjects/WOContext+SoObjects.m index 6bf2c5ad..585d6b63 100644 --- a/sope-appserver/NGObjWeb/SoObjects/WOContext+SoObjects.m +++ b/sope-appserver/NGObjWeb/SoObjects/WOContext+SoObjects.m @@ -21,8 +21,11 @@ #include "WOContext+SoObjects.h" #include "SoObjectRequestHandler.h" +#include "SoObject.h" +#include "SoUser.h" #include "SoSubContext.h" #include "SoSecurityManager.h" +#include "SoHTTPAuthenticator.h" #include #include "common.h" @@ -81,7 +84,25 @@ static BOOL debugOn = NO; ASSIGN(self->activeUser, _user); } - (id)activeUser { - return self->activeUser; + if (self->activeUser == nil) { + /* can only do that if a clientObject is already set */ + id client, auth; + + if ((client = [self clientObject]) != nil) { + auth = [[self clientObject] authenticatorInContext:self]; + self->activeUser = [[auth userInContext:self] retain]; + + if (self->activeUser == nil) { + if (auth == nil) { + [self warnWithFormat:@"Got no authenticator from clientObject: %@", + [self clientObject]]; + } + else + [self warnWithFormat:@"Got no user from authenticator: %@", auth]; + } + } + } + return [self->activeUser isNotNull] ? self->activeUser : nil; } - (void)setObjectDispatcher:(id)_dispatcher { diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index aa8115f9..f162a058 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=177 +SUBMINOR_VERSION:=178 # v4.5.122 requires libNGExtensions v4.5.153 # v4.5.91 requires libNGExtensions v4.5.134