From: John Graham-C. <jgr...@us...> - 2005-04-07 19:55:35
|
Update of /cvsroot/popfile/engine/POPFile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21537/POPFile Modified Files: Configuration.pm History.pm MQ.pm Log Message: More work on v0.23.0 (Multi-user Support) Add account association and allow different users to log in. Users can be associated with specific accounts when POPFile is in multi-user mode. Currently every user has a blank password. Also cloning of per-bucket parameters is not working. Would love to have volunteers to do the following: 1. Test out the new functionality for account association 2. Write code to do per-bucket parameter cloning (see Bayes.pm TODO) 3. Write code to set/reset user passwords. --- Classifer/Bayes.pm: Add functions for handling account creation and deletion and mapping of accounts to users. Add new message called CREAT used to pass a child generated session to the parent. Proxy/Proxy.pm Proxy/POP3.pm: Add code for handling users associated with accounts and use it in the POP3 module to lookup users dynamically when they are logged in. UI/HTML.pm: Update UI to be able to handle different users using the cookie and changes to the History API. Add code to the users_page to handle account association on a per user basis. UI/HTTP.pm: Add url_decode_ and decode form parameters. POPFile/MQ.pm: Comment the CREAT message. POPFile/History.pm: Make history mechanism aware of different users so that different users get a different view of the history. skins/default/user_page.thtml: Add code for handling account association. languages/English.msg: Additional strings needed for the account handling. --- Once this is all working we can start to fix the test suite and nail down the v0.23.0 release. Index: History.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/History.pm,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** History.pm 11 Jan 2005 07:53:06 -0000 1.35 --- History.pm 7 Apr 2005 19:54:45 -0000 1.36 *************** *** 124,127 **** --- 124,133 ---- my ( $self ) = @_; + # Clean up any remaining queries + + foreach my $id (keys %{$self->{queries__}}) { + $self->stop_query( $id ); + } + # Commit any remaining history items. This is needed because it's # possible that we get called with a stop after things have been *************** *** 826,833 **** # stop_query. # #---------------------------------------------------------------------------- sub start_query { ! my ( $self ) = @_; # Think of a large random number, make sure that it hasn't --- 832,841 ---- # stop_query. # + # session API session + # #---------------------------------------------------------------------------- sub start_query { ! my ( $self, $session ) = @_; # Think of a large random number, make sure that it hasn't *************** *** 838,841 **** --- 846,851 ---- if ( !defined( $self->{queries__}{$id} ) ) { + $self->{queries__}{$id}{session} = $session; + $self->{queries__}{$id}{userid} = $self->classifier_()->get_user_id_from_session( $session ); $self->{queries__}{$id}{query} = 0; $self->{queries__}{$id}{count} = 0; *************** *** 863,870 **** # we fill call finish to clean up ! my $q = $self->{queries__}{$id}{query}; ! if ( ( defined $q ) && ( $q != 0 ) && ( $q->{Active} ) ) { ! $q->finish; } --- 873,882 ---- # we fill call finish to clean up ! if ( exists( $self->{queries__}{$id} ) ) { ! my $q = $self->{queries__}{$id}{query}; ! if ( ( defined $q ) && ( $q != 0 ) && ( $q->{Active} ) ) { ! $q->finish; ! } } *************** *** 906,911 **** # to retrieve it all ! $self->{queries__}{$id}{base} = 'select XXX from ! history, buckets, magnets where history.userid = 1 and committed = 1'; $self->{queries__}{$id}{base} .= ' and history.bucketid = buckets.id'; --- 918,925 ---- # to retrieve it all ! my $userid = $self->{queries__}{$id}{userid}; ! ! $self->{queries__}{$id}{base} = "select XXX from history, buckets, ! magnets where history.userid = $userid and committed = 1"; $self->{queries__}{$id}{base} .= ' and history.bucketid = buckets.id'; *************** *** 932,940 **** " and history.magnetid $equal 0"; } else { - my $session = $self->classifier_()->get_session_key( - 'admin', '' ); my $bucketid = $self->classifier_()->get_bucket_id( ! $session, $filter ); ! $self->classifier_()->release_session_key( $session ); $self->{queries__}{$id}{base} .= " and history.bucketid $not_equal $bucketid"; --- 946,951 ---- " and history.magnetid $equal 0"; } else { my $bucketid = $self->classifier_()->get_bucket_id( ! $self->{queries__}{$id}{session}, $filter ); $self->{queries__}{$id}{base} .= " and history.bucketid $not_equal $bucketid"; *************** *** 1137,1141 **** if ( $#msgs != -1 ) { ! my $session = $self->classifier_()->get_session_key( 'admin', '' ); print "\nFound old history files, moving them into database\n "; --- 1148,1152 ---- if ( $#msgs != -1 ) { ! my $session = $self->classifier_()->get_administrator_session_key(); print "\nFound old history files, moving them into database\n "; Index: MQ.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/MQ.pm,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** MQ.pm 28 Feb 2005 12:36:04 -0000 1.20 --- MQ.pm 7 Apr 2005 19:54:45 -0000 1.21 *************** *** 40,44 **** # RELSE Sent when a session key is being released by a client # ! # Copyright (c) 2001-2004 John Graham-Cumming # # This file is part of POPFile --- 40,48 ---- # RELSE Sent when a session key is being released by a client # ! # CREAT A sub-process has created a session key so send the session ! # to the parent so that it can be released by the parent ! # process at the right moment and used for API access ! # ! # Copyright (c) 2001-2005 John Graham-Cumming # # This file is part of POPFile Index: Configuration.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/Configuration.pm,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** Configuration.pm 4 Jan 2005 22:50:37 -0000 1.54 --- Configuration.pm 7 Apr 2005 19:54:44 -0000 1.55 *************** *** 118,121 **** --- 118,128 ---- $self->global_config_( 'message_cutoff', 100000 ); + # Set to 1 if POPFile only supports a single user (the + # administrator) This is the default setting and mirrors the up + # until v0.23.0 operation of POPFile as a single user program. If + # set to 0 then multiple users are supported. + + $self->global_config_( 'single_user', 1 ); + # Register for the TICKD message which is sent hourly by the # Logger module. We use this to hourly save the configuration file |