<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks for taking a look -- <div><br></div><div>In ZLogin (= MyApp)</div><div><font class="Apple-style-span" face="'Courier New'">use Catalyst qw/<br> -Debug<br> ConfigLoader<br> Static::Simple<br> Authentication<br> Authorization::Roles<br> Session<br> Session::Store::File<br> Session::State::Cookie<br>/;</font><br><br></div><div>in zlogin.yml</div><div><br></div><div><font class="Apple-style-span" face="'Courier New'">Plugin::Session:<br> flash_to_stash: 1<br>Controller::Login:<br> traits:<br> - WithRedirect<br><br>Controller::A:<br> actions:<br> test:<br> Does: ACL<br> AllowedRole: <br> - lolevel<br> ACLDetachTo: /login/required<br> LoginRedirectMessage: Please Login to view this Action<br> <br>Plugin::Authentication:<br> default_realm: users<br> realms:<br> users:<br> credential:<br> class: Password<br> password_field: password<br> password_type: clear<br> store:<br> class: DBIx::Class<br> user_model: Users::Users<br> role_relation: roles<br> role_field: role<br><br></font></div><div><font class="Apple-style-span" face="'Courier New'">Model::Users:<br> schema_class: ZLogin::Schema<br> connect_info:<br> - dbi:mysql:q<br> - esd<br> - esd<br> - <br> AutoCommit: 1<br> mysql_enable_utf8: 1<br></font><br></div><div>Controller A</div><div><div><b><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">package ZLogin::Controller::A;</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">use Moose;</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">use namespace::autoclean;</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;"><br></span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">BEGIN { extends 'Catalyst::Controller::ActionRole' }</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;"><br></span></font></div><div><span class="Apple-style-span" style="font-weight: normal; "><b><div style="display: inline !important; "><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">sub index :Path :Args(0) {</span></font></div></b></span></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;"> my ( $self, $c ) = @_;</span></font></div><div><span class="Apple-style-span" style="font-weight: normal; "><b><div style="display: inline !important; "><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;"> $c->response->body('Matched ZLogin::Controller::A in A.');</span></font></div></b></span></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">}</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;"><br></span></font></div><div><span class="Apple-style-span" style="font-weight: normal; "><b><div style="display: inline !important; "><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">sub test : Path('/b')</span></font></div></b></span></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">{</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;"> my ( $self, $c ) = @_;</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;"> $c->log->debug('logged in b.');</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;"> $c->stash(</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;"> template => 'a/test.tt',</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;"> );</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">}</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;"><br></span></font></div><div><span class="Apple-style-span" style="font-weight: normal; "><b><div style="display: inline !important; "><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">__PACKAGE__->meta->make_immutable;</span></font></div></b></span></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;"><br></span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">1;</span></font></div><div><br></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">test.tt</span></font><span class="Apple-style-span" style="font-weight: normal;"> just contains a plain text message.</span></div><div><br></div></b></div></div><div>In Controller::Login (pointless, I know, but I have been trying to put code in here for debugging/fixing. I earlier tried with +<font class="Apple-style-span" face="'Courier New'">CatalystX::SimpleLogin</font> in the app's <font class="Apple-style-span" face="'Courier New'">use Catalyst</font> list, which seems to have the same effect.)</div><div><br></div><div><div><font class="Apple-style-span" face="'Courier New'">package ZLogin::Controller::Login;</font></div><div><font class="Apple-style-span" face="'Courier New'">use Moose;</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">use namespace::autoclean;</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">BEGIN { extends 'CatalystX::SimpleLogin::Controller::Login' }</font></div><div><font class="Apple-style-span" face="'Courier New'">=head1 NAME</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">ZLogin::Controller::Login - Catalyst Controller</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">=head1 DESCRIPTION</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">Catalyst Controller.</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">=head1 METHODS</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">=cut</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">=head2 index</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">=cut</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">__PACKAGE__->meta->make_immutable;</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">1;</font></div></div><div><br></div><div>Finally, I think, in the q database:</div><div><div><font class="Apple-style-span" face="'Courier New'">CREATE TABLE users (</font></div><div><font class="Apple-style-span" face="'Courier New'"> id INTEGER PRIMARY KEY,</font></div><div><font class="Apple-style-span" face="'Courier New'"> username TEXT,</font></div><div><font class="Apple-style-span" face="'Courier New'"> password TEXT</font></div><div><font class="Apple-style-span" face="'Courier New'"> );</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'"> CREATE TABLE roles (</font></div><div><font class="Apple-style-span" face="'Courier New'"> id INTEGER PRIMARY KEY,</font></div><div><font class="Apple-style-span" face="'Courier New'"> role TEXT</font></div><div><font class="Apple-style-span" face="'Courier New'"> );</font></div><div><font class="Apple-style-span" face="'Courier New'"> CREATE TABLE user_roles (</font></div><div><font class="Apple-style-span" face="'Courier New'"> user_id INTEGER,</font></div><div><font class="Apple-style-span" face="'Courier New'"> role_id INTEGER,</font></div><div><font class="Apple-style-span" face="'Courier New'"> PRIMARY KEY (user_id, role_id)</font></div><div><font class="Apple-style-span" face="'Courier New'"> );</font></div></div><div><br></div><div>Harold</div><div><br></div><div><br></div><div>On 28 Dec 2010, at 12:08, Tomas Doran wrote:<br><br><blockquote type="cite"><br>On 28 Dec 2010, at 00:51, Harold Frayman wrote:<br><br><blockquote type="cite">Hi<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I'm trying to use CatalystX::SimpleLogin with multiple roles via DBIx::Class and with Redirect.<br></blockquote><blockquote type="cite">What should happen, when a user is redirected to log in and does so but without the level of authorization required for the method they were trying to call?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">For example. In Controller::A, method b ( :Path('/b') Args(0) ) is configured as<br></blockquote><blockquote type="cite">Does: ACL<br></blockquote><blockquote type="cite">AllowedRole:<br></blockquote><blockquote type="cite"> - hilevel<br></blockquote><blockquote type="cite">ACLDetachTo: /login/required<br></blockquote><blockquote type="cite">LoginRedirectMessage: Please Login to view this Action<br></blockquote><blockquote type="cite"><br></blockquote><br>Can you show me some of the actual code for this controller?<br><br>Are you inheriting of Catalyst::Controller::ActionRole?<br><br><blockquote type="cite">User, not logged in, addresses .../b and is presented with the login form (as expected and desired). They identify themselves correctly but have only one role: lolevel, which is not authorised to use method b.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">What seems to happen for me is that either (1) if there exists a template a/b.tt, irs contents are displayed even though the user is not auhtorised or (2) if the template specified is anything else or not specified (eg use $c->res->body), we get an error "Couldn't render template "a/b.tt: file error - a/b.tt: not found" -- which is true but unhelpful.<br></blockquote><br>So the actionrole doesn't even seem to be fired at all.. That's between you and ActionRole::ACL really - nothing to do with SimpleLogin.<br><br>But show me some actual code and I'll be happy to try to help :)<br><br>Cheers<br>t0m<br><br><br>_______________________________________________<br>List: <a href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a><br>Listinfo: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a><br>Searchable archive: <a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a><br>Dev site: <a href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a><br></blockquote><br></div></body></html>