[jifty-devel] RFC: Login/Logout functionality

John Peacock jpeacock at rowman.com
Sun Jun 11 21:19:53 EDT 2006


Alex Vandiver wrote:
> So we have a rough pass at a plugin framework now.  I'd be interested in
> if you think it is powerful enough in its current state to write a
> generic login plugin.  I'd also be curious as to how much of the signup
> process can be abstracted away.

I've finally had some time to look at creating Jifty::Plugin::Login (based
completely on the login bits in Wifty) and I'm at a bit of a brick wall.  It
seems like the call to Jifty->api->allow (in J::Plugins::new_request) isn't
affecting the application's list of allowed actions.  I've confirmed that
J::P::Login::new_request is being called (by creating a wrapper), but even if I
replace it with the exact same code that is in the base class, nothing is being
added.

For example, using the Tutorial website, I added this to etc/config.yml:

  Plugins:
    - Login: {}

and I added the following to Jifty/Plugin/Login.pm:

sub new_request {
    my $self = shift;
    my $class = ref($self) || $self;
    Jifty->api->allow(qr/^\Q__PACKAGE__\E::Action/);
    my @actions = Jifty::API->new()->actions();
    print STDERR Data::Dumper->Dump(\@actions);
}

and what displays in the console window when I hit the site is:

$VAR1 = 'Jifty::Action::Autocomplete';
$VAR2 = 'Jifty::Action::Redirect';
$VAR3 = 'MyWeblog::Action::CreateLogin';
$VAR4 = 'MyWeblog::Action::CreatePost';
$VAR5 = 'MyWeblog::Action::DeleteLogin';
$VAR6 = 'MyWeblog::Action::DeletePost';
$VAR7 = 'MyWeblog::Action::UpdateLogin';
$VAR8 = 'MyWeblog::Action::UpdatePost';

which agrees with what displays if I put something similar in the index.html
page.  If I try and hit the /login action, I get:

ERROR - Can't locate MyWeblog/Action/Login.pm in @INC (@INC contains:
/home/jpeacock/tmp/MyWeblog/lib /usr/lib/perl5/5.8.7/i586-linux-thread-multi
/usr/lib/perl5/5.8.7 /usr/lib/perl5/site_perl/5.8.7/i586-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.7/i586-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl .
Jifty::ClassLoader=HASH(0x9480adc) Jifty::ClassLoader=HASH(0x9bc9e10)) at
/usr/lib/perl5/site_perl/5.8.7/Jifty/Web.pm line 374

which confirms that the allow isn't happening.

What am I missing???

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747


More information about the jifty-devel mailing list