[Catalyst] 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? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst Roles With ACL
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@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
RE: [Catalyst] Catalyst Roles With ACL
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: bobtf...@bobtfish.net Date: Tue, 14 Aug 2012 19:12:23 +0100 To: catalyst@lists.scsys.co.uk 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@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/