From: helge Date: Fri, 8 Jul 2005 16:37:20 +0000 (+0000) Subject: added new auth realm method X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffb5a0317b0f21112554ded18dfae04c21dc9b53;p=sope added new auth realm method improved take-values debugging git-svn-id: http://svn.opengroupware.org/SOPE/trunk@874 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 6ebafbc8..20644610 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,10 @@ +2005-07-08 Helge Hess + + * SoObjects/SoHTTPAuthenticator.m: deprecated -authRealm, replaced with + -authRealmInContext: (v4.5.170) + + * WOComponent.m: added support for WODebugTakeValues (v4.5.169) + 2005-07-06 Helge Hess * WebDAV/SoObjectWebDAVDispatcher.m: fixed an issue when trying to call diff --git a/sope-appserver/NGObjWeb/DynamicElements/WOHiddenField.m b/sope-appserver/NGObjWeb/DynamicElements/WOHiddenField.m index f50b260b..e5be4c2c 100644 --- a/sope-appserver/NGObjWeb/DynamicElements/WOHiddenField.m +++ b/sope-appserver/NGObjWeb/DynamicElements/WOHiddenField.m @@ -20,7 +20,6 @@ */ #include "WOInput.h" -#include "decommon.h" @interface WOHiddenField : WOInput { @@ -33,42 +32,43 @@ @end /* WOHiddenField */ +#include "decommon.h" + @implementation WOHiddenField -// responder +/* generate response */ - (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx { - if (![[_ctx request] isFromClientComponent]) { - BOOL isDisabled; + NSString *v; + BOOL isDisabled; + + if ([[_ctx request] isFromClientComponent]) + return; - isDisabled = [self->disabled boolValueInComponent:[_ctx component]]; + isDisabled = [self->disabled boolValueInComponent:[_ctx component]]; - if (isDisabled) { - NSString *s; - - s = [self->value stringValueInComponent:[_ctx component]]; - [_response appendContentHTMLString:s]; - } - else { - NSString *v; - - v = [self->value stringValueInComponent:[_ctx component]]; - - WOResponse_AddCString(_response, "otherTagString) { + if (isDisabled) { + // TODO: this is correct for a _hidden_? + v = [self->value stringValueInComponent:[_ctx component]]; + [_response appendContentHTMLString:v]; + return; + } + + v = [self->value stringValueInComponent:[_ctx component]]; + + WOResponse_AddCString(_response, "otherTagString != nil) { WOResponse_AddChar(_response, ' '); WOResponse_AddString(_response, [self->otherTagString stringValueInComponent: [_ctx component]]); - } - WOResponse_AddEmptyCloseParens(_response, _ctx); - } } + WOResponse_AddEmptyCloseParens(_response, _ctx); } @end /* WOHiddenField */ diff --git a/sope-appserver/NGObjWeb/DynamicElements/WOInput.m b/sope-appserver/NGObjWeb/DynamicElements/WOInput.m index 075d7449..5d5f1950 100644 --- a/sope-appserver/NGObjWeb/DynamicElements/WOInput.m +++ b/sope-appserver/NGObjWeb/DynamicElements/WOInput.m @@ -25,16 +25,21 @@ @implementation WOInput -static BOOL takeValueDebugOn = NO; +static BOOL takeValueDebugOn = YES; + (int)version { return [super version] + 0 /* v2 */; } + (void)initialize { + NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; + NSAssert2([super version] == 2, @"invalid superclass (%@) version %i !", NSStringFromClass([self superclass]), [super version]); + + if ((takeValueDebugOn = [ud boolForKey:@"WODebugTakeValues"])) + NSLog(@"WOInput: WODebugTakeValues on."); } - (id)initWithName:(NSString *)_name diff --git a/sope-appserver/NGObjWeb/SoObjects/SoHTTPAuthenticator.h b/sope-appserver/NGObjWeb/SoObjects/SoHTTPAuthenticator.h index 131ccad5..05be2a8c 100644 --- a/sope-appserver/NGObjWeb/SoObjects/SoHTTPAuthenticator.h +++ b/sope-appserver/NGObjWeb/SoObjects/SoHTTPAuthenticator.h @@ -48,7 +48,7 @@ /* HTTP basic authentication */ -- (NSString *)authRealm; +- (NSString *)authRealmInContext:(WOContext *)_ctx; - (WOResponse *)preprocessCredentialsInContext:(WOContext *)_ctx; - (NSString *)checkCredentials:(NSString *)_creds; diff --git a/sope-appserver/NGObjWeb/SoObjects/SoHTTPAuthenticator.m b/sope-appserver/NGObjWeb/SoObjects/SoHTTPAuthenticator.m index 802e4dc5..c7c6de3a 100644 --- a/sope-appserver/NGObjWeb/SoObjects/SoHTTPAuthenticator.m +++ b/sope-appserver/NGObjWeb/SoObjects/SoHTTPAuthenticator.m @@ -45,8 +45,12 @@ /* HTTP basic authentication */ - (NSString *)authRealm { + // DEPRECATED return [(WOApplication *)[WOApplication application] name]; } +- (NSString *)authRealmInContext:(WOContext *)_ctx { + return [self authRealm]; +} /* check for roles */ @@ -173,7 +177,8 @@ if ([_reason length] == 0) _reason = @"Unauthorized"; - auth = [NSString stringWithFormat:@"basic realm=\"%@\"", [self authRealm]]; + auth = [NSString stringWithFormat:@"basic realm=\"%@\"", + [self authRealmInContext:_ctx]]; r = [_ctx response]; [r setStatus:401 /* unauthorized */]; @@ -274,7 +279,8 @@ NSString *auth; r = [_ctx response]; - auth = [NSString stringWithFormat:@"basic realm=\"%@\"", [self authRealm]]; + auth = [NSString stringWithFormat:@"basic realm=\"%@\"", + [self authRealmInContext:_ctx]]; [r setStatus:[_e httpStatus] /* unauthorized */]; [r setHeader:auth forKey:@"www-authenticate"]; return YES; diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index ea793f0d..105404a0 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=168 +SUBMINOR_VERSION:=170 # v4.5.122 requires libNGExtensions v4.5.153 # v4.5.91 requires libNGExtensions v4.5.134 diff --git a/sope-appserver/NGObjWeb/WOComponent.m b/sope-appserver/NGObjWeb/WOComponent.m index e6360fcd..a6c86efa 100644 --- a/sope-appserver/NGObjWeb/WOComponent.m +++ b/sope-appserver/NGObjWeb/WOComponent.m @@ -59,6 +59,7 @@ static NGLogger *perfLogger = nil; static BOOL debugOn = NO; static BOOL debugComponentAwake = NO; static BOOL debugTemplates = NO; +static BOOL debugTakeValues = NO; static BOOL abortOnAwakeComponentInCtxDealloc = NO; static BOOL abortOnMissingCtx = NO; static BOOL wakeupPageOnCreation = NO; @@ -87,6 +88,10 @@ static BOOL wakeupPageOnCreation = NO; perfLogger = [lm loggerForDefaultKey:@"WOProfileElements"]; debugOn = [WOApplication isDebuggingEnabled]; debugComponentAwake = [ud boolForKey:@"WODebugComponentAwake"]; + + if ((debugTakeValues = [ud boolForKey:@"WODebugTakeValues"])) + NSLog(@"WOComponent: WODebugTakeValues on."); + abortOnAwakeComponentInCtxDealloc = [ud boolForKey:@"WOCoreOnAwakeComponentInCtxDealloc"]; } @@ -841,22 +846,30 @@ static inline id _getExtraVar(WOComponent *self, NSString *_key) { /* OWResponder */ -- (BOOL)shouldTakeValuesFromRequest:(WORequest *)_rq inContext:(WOContext*)_c{ +- (BOOL)shouldTakeValuesFromRequest:(WORequest *)_rq inContext:(WOContext*)_c { + if (debugTakeValues) + [self debugWithFormat:@"%s: default says no.", __PRETTY_FUNCTION__]; return NO; } - (void)takeValuesFromRequest:(WORequest *)_req inContext:(WOContext *)_ctx { WOElement *template = nil; + if (debugTakeValues) + [self debugWithFormat:@"take values from rq 0x%08X", _req]; + NSAssert1(self->componentFlags.isAwake, @"component %@ is not awake !", self); [self _setContext:_ctx]; template = [self _woComponentTemplate]; - if (template == nil) + if (template == nil) { + if (debugTakeValues) + [self debugWithFormat:@"cannot take values, component has no template!"]; return; - + } + if (template->takeValues) { template->takeValues(template, @selector(takeValuesFromRequest:inContext:),