[Catalyst] Perl code attributes in Moose roles
Bernhard Graf
catalyst4 at augensalat.de
Sat Dec 19 22:47:24 GMT 2009
Florian Ragwitz schrieb:
> Yes, it's referred to from several places in the docs and is called
> MooseX::MethodAttributes::Role.
Ah, thank you!
This brings mit directly to my next question.
Assume I have this role:
package MyApp::Role::Controller::Create;
use Mose::Role;
sub edit_new : PathPart(edit) Chained(root) Args(0) {
...
}
1;
__END__
Now I have many consumers of that role, but those have different
authorization requirements. ATM I use Catalyst::ActionRole::ACL like this:
package MyApp::Base::User;
sub edit_new :
PathPart(edit) Chained(root) Args(0)
Does(ACL) AllowedRole(admin) ACLDetachTo(/forbidden)
{ ... }
package MyApp::Base::Page;
sub edit_new :
PathPart(edit) Chained(root) Args(0)
Does(ACL) AllowedRole(editor) ACLDetachTo(/forbidden)
{ ... }
Now this becomes:
package MyApp::Base::User;
with 'MyApp::Role::Controller::Create';
package MyApp::Base::Page;
with 'MyApp::Role::Controller::Create';
Where can I add the ACL attributes for edit_new?
Bernhard Graf
More information about the Catalyst
mailing list