Re: Remembering who answered an authenticated survey

Joel Palmius <[email protected]> Thu, 30 Mar 2006 11:23:05 +0200 (CEST)
Newsgroups gmane.comp.apache.mod-survey.general
Message-ID <[email protected]>
I've fixed the token/multipage issue. Attached patch should apply to 
latest release of mod_survey.

* Remember tokens across pages in multipage survey
* Default TOKENARG to "token" (so one does not have to specify it in the
   TOKENAUTH tag unless one absolutely wants something else)

The latest stable svn also contain this fix.

   // Joel


On Thu, 30 Mar 2006, Joel Palmius wrote:

> Tokenauth relies on some manual perl code in the backend, and is not really 
> an authentication in the apache sense. I agree it should be remembered 
> though.
>
> If you can use fileauth or dbiauth instead, this is automatically remembered 
> by apache. An easy way to extract this information is by using an ENV tag:
>
>  <ENV NAME="user" FIELD="REMOTE_USER" />
>
> You can make fileauth work pretty much as tokenauth (ie auth via GET string), 
> although you have to add two fields:
>
> You can make fileauth work pretty much like tokenauth, although you have to 
> add two fields:
>
>  ..humptidum.survey?action=display&username=justme&password=mypass
>
> I think this should work. I note the tokenauth forgotten thing as a bug.
>
>  // Joel
>
>
>
> On Tue, 28 Mar 2006, Florian Hars wrote:
>
>>  Is there a way to remember who answered a survey? The information must be
>>  there the moment the user is authenticated (in my case via TOKENAUTH), but
>>  as far as I can see the documentation does not describe how to store this
>>  information with the data.
>>
>>  Yours, Florian.
>>  Skickat av Florian Hars <[email protected]>
>>  till survey-discussion
>> 
>> 
> Skickat av Joel Palmius <[email protected]>
> till survey-discussion
>
>
token.patch (text/plain, 2.8 KB)
diff -Nbrc --exclude=.svn --exclude='*.orig' --exclude='*~' --exclude='*.bak' --exclude='*.sl' --exclude='*.po' --exclude='*.conf' --exclude=data --exclude=docs --exclude='Domain*' --exclude=ilse full_tree/branches/32x/mod_survey/Survey/Auth/TokenAuth.pm mod_survey/Survey/Auth/TokenAuth.pm
*** full_tree/branches/32x/mod_survey/Survey/Auth/TokenAuth.pm	2006-01-18 13:08:44.394732000 +0100
--- mod_survey/Survey/Auth/TokenAuth.pm	2006-03-30 11:06:52.022524500 +0200
***************
*** 170,177 ****
--- 170,188 ----
          # db takes precedence on file
          $tokenMedia = "db";
      }
+ 
      my $token = $self->{ARGUMENT}->ArgByName($doc->GetOption("TOKENARG"));
  
+     if(!$token)
+     {
+       $token = $self->{SESSION}->getValue($doc->GetOption("TOKENARG"));
+     }
+ 
+     if($token)
+     {
+       $self->{SESSION}->setValue($doc->GetOption("TOKENARG"),$token);
+     }
+     
      $doc->{SESSION}->setValue("TOKENAPPEND", $doc->GetOption("TOKENARG") . "=" . $token);
  
      if ($tokenMedia eq "file")
***************
*** 228,235 ****
--- 239,257 ----
          # db takes precedence on file
          $tokenMedia = "db";
      }
+ 
      my $token = $self->{ARGUMENT}->ArgByName($doc->GetOption("TOKENARG"));
  
+     if(!$token)
+     {
+       $token = $self->{SESSION}->getValue($doc->GetOption("TOKENARG"));
+     }
+ 
+     if($token)
+     {
+       $self->{SESSION}->setValue($doc->GetOption("TOKENARG"),$token);
+     }
+     
      $doc->{SESSION}->setValue("TOKENAPPEND", $doc->GetOption("TOKENARG") . "=" . $token);
  
      if ($tokenMedia eq "file")
diff -Nbrc --exclude=.svn --exclude='*.orig' --exclude='*~' --exclude='*.bak' --exclude='*.sl' --exclude='*.po' --exclude='*.conf' --exclude=data --exclude=docs --exclude='Domain*' --exclude=ilse full_tree/branches/32x/mod_survey/Survey/Component/Security.pm mod_survey/Survey/Component/Security.pm
*** full_tree/branches/32x/mod_survey/Survey/Component/Security.pm	2006-01-18 13:08:44.698599000 +0100
--- mod_survey/Survey/Component/Security.pm	2006-03-30 10:55:38.433751000 +0200
***************
*** 145,151 ****
      $self->{"TOKENAUTH_TYPE"}       = "TOKENAUTH";
      $self->{"TOKENAUTH_USERFILE"}   = "";
      $self->{"TOKENAUTH_RESPFILE"}   = "";
!     $self->{"TOKENAUTH_ARG"}        = "";
      $self->{"TOKENAUTH_APPEND"}     = "";
      $self->{"TOKENAUTH_DBIDSN"}     = "";
      $self->{"TOKENAUTH_DBIUSER"}    = "";
--- 145,151 ----
      $self->{"TOKENAUTH_TYPE"}       = "TOKENAUTH";
      $self->{"TOKENAUTH_USERFILE"}   = "";
      $self->{"TOKENAUTH_RESPFILE"}   = "";
!     $self->{"TOKENAUTH_ARG"}        = "token";
      $self->{"TOKENAUTH_APPEND"}     = "";
      $self->{"TOKENAUTH_DBIDSN"}     = "";
      $self->{"TOKENAUTH_DBIUSER"}    = "";