+2005-07-21 Helge Hess <helge.hess@opengroupware.org>
+
+ * 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 <znek@mulle-kybernetik.com>
* v4.5.177
#include "WOContext+SoObjects.h"
#include "SoObjectRequestHandler.h"
+#include "SoObject.h"
+#include "SoUser.h"
#include "SoSubContext.h"
#include "SoSecurityManager.h"
+#include "SoHTTPAuthenticator.h"
#include <NGObjWeb/WOComponent.h>
#include "common.h"
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 {