Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Catalyst Roles With ACL

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


grandmasterblaine at hotmail

Aug 14, 2012, 10:12 AM

Post #1 of 3 (371 views)
Permalink
Catalyst Roles With ACL

Hi,

I am trying to get role based authorization going in my catalyst app. However, I'm encountering difficultly on what should be an easy task.

My database basically has four tables for users

User - Main User data with foren keys to User Account(has many) and UserToRole (has many)
UserAccount - Data to store account login type (ie openid, facebook etc)
UserToRole - Linkage table from user to user role
UserRole - table with the role names.

My Package config looks like:

__PACKAGE__->config
( name => "Signup::Web",
"Plugin::Authentication" => {
default_realm => "facebook",
realms => {
facebook =>{
credential =>{
class => "FBConnect",
api_key => __PACKAGE__->config->{facebookConnect}->{api_key},
secret => __PACKAGE__->config->{facebookConnect}->{secret},
app_name => __PACKAGE__->config->{facebookConnect}->{app_name}
},
store => {
class => 'DBIx::Class',
user_model => 'MyApp::User',
role_relation => 'user_to_roles',
role_field => 'title'
}

},
... more auth types
});

When I try and run my program I get
Failed to load user data. You passed [ARRAY(0x39a8964)] to authenticate() but your user source (MyApp::User) only has these columns: [id,alias,name_first,name_last,email] Check your authenticate() call.

Any idea on how I can load the roles?


bobtfish at bobtfish

Aug 14, 2012, 11:12 AM

Post #2 of 3 (360 views)
Permalink
Re: Catalyst Roles With ACL [In reply to]

On 14 Aug 2012, at 18:12, Blaine Everingham wrote:
>
> When I try and run my program I get
> Failed to load user data. You passed [ARRAY(0x39a8964)] to authenticate() but your user source (MyApp::User) only has these columns: [id,alias,name_first,name_last,email] Check your authenticate() call.
>
> Any idea on how I can load the roles?


You didn't show us the ->authenticate() call in your code that the error message tells you is the problem.

Before doing anything else, I'd like to see that call, to check it isn't the source of the problem ;_)

Cheers
t0m


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


grandmasterblaine at hotmail

Aug 14, 2012, 12:13 PM

Post #3 of 3 (362 views)
Permalink
RE: Catalyst Roles With ACL [In reply to]

Sorry I missed that. I suppose it's possible that this call is the issue.. But it was working just fine before I tried to add ACL.
sub authenticateOpenid :Path('openid') :Args(0) { my($self, $c) = @_;
$c->log->debug( "authenticateOpenID" );
if ( $c->authenticate({}, 'openid') ){ ## Check if the user's profile already exists ## If not create a new one. if ( !$c->forward('userVerify') ){ $c->forward("/login/userCreate" ); } $c->res->redirect( $c->uri_for('/') ); } else { # Show Login Form $c->stash('error' => "Sorry your login failed."); $c->res->redirect( $c->uri_for('/login') ); } }

> Subject: Re: [Catalyst] Catalyst Roles With ACL
> From: bobtfish [at] bobtfish
> Date: Tue, 14 Aug 2012 19:12:23 +0100
> To: catalyst [at] lists
>
>
> On 14 Aug 2012, at 18:12, Blaine Everingham wrote:
> >
> > When I try and run my program I get
> > Failed to load user data. You passed [ARRAY(0x39a8964)] to authenticate() but your user source (MyApp::User) only has these columns: [id,alias,name_first,name_last,email] Check your authenticate() call.
> >
> > Any idea on how I can load the roles?
>
>
> You didn't show us the ->authenticate() call in your code that the error message tells you is the problem.
>
> Before doing anything else, I'd like to see that call, to check it isn't the source of the problem ;_)
>
> Cheers
> t0m
>
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.