<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Sadly, it was not clear to me that you could have only one ActionClass per handler. I finally figured it out after tracing things and reading lots of perldoc. &lt;sigh> I'm new to this. It worked fine for my paths that were not RESTful also :-)</div><div><br></div><div>I see the notes about a proposed patch (<a href="http://www.mail-archive.com/catalyst@lists.rawmode.org/msg04135.html)">http://www.mail-archive.com/catalyst@lists.rawmode.org/msg04135.html)</a> which redirected to a Grand Unified Theory of Rearchitecture (instead of applying the patch). Dumb question -- where can I read more about the rearchitecture?</div><div><br></div><div><br></div><div>Anyways, I have a real issue and a proposal --</div><div><br></div><div>So here's what I want to do:</div><div><br></div><div>--- Controller ---</div><div>...</div><div><div>sub config_element :Path('') &nbsp;ActionClass('REST') ActionClass( 'LoginRequired' )</div><div>{</div><div>&nbsp;&nbsp; &nbsp;my ( $self, $c ) = @_;</div><div>&nbsp;&nbsp; &nbsp;</div><div>&nbsp;&nbsp; $c->log->debug("I only get this if I'm logged in!");</div><div>}</div><div>...</div><div>------</div><div><br></div><div>--- MyApp::Action::LoginRequired ---</div><div><div>...</div><div>sub execute</div><div>{</div><div>&nbsp;&nbsp; &nbsp;my $self = shift;</div><div>&nbsp;&nbsp; &nbsp;my ( $controller, $c, @args ) = @_;</div><div><br></div><div>&nbsp;&nbsp; &nbsp;if (&nbsp;! $c->session->{'logged_in'} )</div><div>&nbsp;&nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$c->detach('/login_required');</div><div>&nbsp;&nbsp; &nbsp;}</div><div>&nbsp;&nbsp; &nbsp;</div><div>&nbsp;&nbsp; &nbsp;my $r = $self->next::method(@_);</div><div><br></div><div>&nbsp;&nbsp; &nbsp;return $r;</div><div>}</div><div>...</div><div>-------</div><div><br></div></div><div>Why? It just seemed way cleaner to me (LoginRequired *is* attribute-y to me :-) than repeated:</div><div>---</div><div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$c->detach('/login_required') unless&nbsp;$c->session->{'logged_in'};</div><div>---</div><div><br></div><div>lines throughout all of my methods. Specifically, I added a "auth not required" mode in which login-requirements were temporarily defeated, and I had to go edit every path everywhere that had this code bit. Sure, I can turn "$c->session->{'logged_in'}" into a app/context method call and have the code only there...but it misses the point (or *I* miss the point).</div><div><br></div><div>Attributes are decorators and meta-behaviours, and access requirements seemed like a perfect example of this to me. Obviously they don't have to be ActionClass(es).</div><div><br></div><div>So (he says, phrasing it in the form of an RFC), would there be any traction in pursuing a Auththent/Author/ACL attribute that slots in?&nbsp;</div><div><br></div><div>Something like:</div><div><br></div><div><div>sub mypath1 : AllowWhen( 'authenticated' ) { }</div><div><div>sub mypath2 : AllowWhen( 'hasanyrole(foo,bar)' ) { } &nbsp;# permitted if user has any of the roles</div><div>sub mypath3 : AllowWhen( 'hasallroles(organization1,administration)' ) { } &nbsp; # permitted if user has all of the roles &nbsp;</div><div><br></div><div>May I have feedback (up to and hopefully not including "please go away" :-)</div><div><br></div><div>Thanks very much for your time.</div><div><br></div><div>Bruce</div><div><br></div><div><br></div></div></div></div><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>---</div><div>Bruce McKenzie</div><div><a href="mailto:brucem@dynamicrange.com">brucem@dynamicrange.com</a></div><div><br></div></div></span><br class="Apple-interchange-newline"> </div><br></div></body></html>