<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks for taking a look --&nbsp;<div><br></div><div>In &nbsp;ZLogin (= MyApp)</div><div><font class="Apple-style-span" face="'Courier New'">use Catalyst qw/<br>&nbsp;&nbsp; &nbsp;-Debug<br>&nbsp;&nbsp; &nbsp;ConfigLoader<br>&nbsp;&nbsp; &nbsp;Static::Simple<br>&nbsp;&nbsp; &nbsp;Authentication<br>&nbsp;&nbsp; &nbsp;Authorization::Roles<br>&nbsp;&nbsp; &nbsp;Session<br>&nbsp;&nbsp; &nbsp;Session::Store::File<br>&nbsp;&nbsp; &nbsp;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>&nbsp;&nbsp;flash_to_stash: 1<br>Controller::Login:<br>&nbsp;&nbsp;traits:<br>&nbsp;&nbsp; &nbsp;- WithRedirect<br><br>Controller::A:<br>&nbsp;&nbsp;actions:<br>&nbsp;&nbsp; &nbsp;test:<br>&nbsp;&nbsp; &nbsp; &nbsp;Does: ACL<br>&nbsp;&nbsp; &nbsp; &nbsp;AllowedRole:&nbsp;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;- lolevel<br>&nbsp;&nbsp; &nbsp; &nbsp;ACLDetachTo: /login/required<br>&nbsp;&nbsp; &nbsp; &nbsp;LoginRedirectMessage: Please Login to view this Action<br>&nbsp;&nbsp; &nbsp; &nbsp;<br>Plugin::Authentication:<br>&nbsp;&nbsp;default_realm: users<br>&nbsp;&nbsp;realms:<br>&nbsp;&nbsp; &nbsp;users:<br>&nbsp;&nbsp; &nbsp; &nbsp;credential:<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;class: Password<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;password_field: password<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;password_type: clear<br>&nbsp;&nbsp; &nbsp; &nbsp;store:<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;class: DBIx::Class<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;user_model: Users::Users<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;role_relation: roles<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;role_field: role<br><br></font></div><div><font class="Apple-style-span" face="'Courier New'">Model::Users:<br>&nbsp;&nbsp;schema_class: ZLogin::Schema<br>&nbsp;&nbsp;connect_info:<br>&nbsp;&nbsp; &nbsp;- dbi:mysql:q<br>&nbsp;&nbsp; &nbsp;- esd<br>&nbsp;&nbsp; &nbsp;- esd<br>&nbsp;&nbsp; &nbsp;-&nbsp;<br>&nbsp;&nbsp; &nbsp; &nbsp;AutoCommit: 1<br>&nbsp;&nbsp; &nbsp; &nbsp;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;">&nbsp;&nbsp; &nbsp;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;">&nbsp;&nbsp; &nbsp;$c-&gt;response-&gt;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;">&nbsp;&nbsp;my ( $self, $c ) = @_;</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">&nbsp;&nbsp;$c-&gt;log-&gt;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;">&nbsp;&nbsp;$c-&gt;stash(</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">&nbsp;&nbsp; &nbsp;template =&gt; 'a/test.tt',</span></font></div><div><font class="Apple-style-span" face="'Courier New'"><span class="Apple-style-span" style="font-weight: normal;">&nbsp;&nbsp;);</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__-&gt;meta-&gt;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__-&gt;meta-&gt;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'">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;id &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;INTEGER PRIMARY KEY,</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;username &nbsp; &nbsp; &nbsp;TEXT,</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;password &nbsp; &nbsp; &nbsp;TEXT</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp;);</font></div><div><font class="Apple-style-span" face="'Courier New'"><br></font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp;CREATE TABLE roles (</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;id &nbsp; INTEGER PRIMARY KEY,</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;role TEXT</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp;);</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp;CREATE TABLE user_roles (</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;user_id INTEGER,</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;role_id INTEGER,</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PRIMARY KEY (user_id, role_id)</font></div><div><font class="Apple-style-span" face="'Courier New'">&nbsp;&nbsp; &nbsp;);</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">&nbsp;&nbsp; &nbsp;- 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&nbsp;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&nbsp;or not specified (eg use $c-&gt;res-&gt;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>