[Catalyst] RFC: Reusable actions

Ted Carnahan ted at tedcarnahan.com
Thu Apr 6 17:00:34 CEST 2006


Reusable actions might be an interesting way of handling ACL rules.  The 
ACL options right now are:
  - Maintain the ACL in your app's main module (clunky, too separate 
from the actions it's trying to control access to)
  - Write a bit of code to allow you to "pre-declare" your ACL rules in 
your controller classes (solves the separation problem, but is very ugly)
  - Something else I'm not aware of?

It would be useful to be able to do:

package MyApp::Controller::Users
use base 'Catalyst::Controller';
sub profile : Local : Action('ACL::Owner_or_Admin') {
	my ( $self, $c, $id ) = @_;
	# Show a user's profile for UID $id
}
1;

package MyApp::Action::ACL::Owner_or_Admin;
use base 'Catalyst::Action';
sub before {
	# Verify that the logged in user is either
	# an Admin or the owner of this Profile
}
1;

As for namespaces, what about "Aspect" or "Filter"?  I also liked "Extend".

Peace,

Ted



More information about the Catalyst mailing list