Hello!
I'm trying to add a component to DBIx::Class.
I have an object hierarchy with acl checking on each level. The
algorithm is simple (but will be extended) and uniform (and will remain so).
If we have a defined access field, make decision using it.
If no, and we have a parent, ask parent.
If no, and we have no parent, deny.
So, I've written
__PACKAGE__->load_components(qw(+Forum::Schema::Component::ACL));
__PACKAGE__->acl_setup(parent => 'part', user_acl => 'part_acls',
group_acl => 'part_group_acls');
in my Result class.
In Component::ACL:
sub acl_setup {
my $caller = shift;
$params->{$caller} = { @_ };
}
sub check_acls
{
my ($self, $c, $mode) = @_;
my $caller = ref $self->result_source;
die "No config for $caller"
unless defined $config->{$caller};
...
}
The problem is that during setup I'm getting
Forum::Schema::Result::SOMETHING, but in runtime -
Forum::Schema::DB::SOMETHING (my model is called DB), and I did not find
any way to retreive ::Result:: class name from ::DB:: class. Of course,
I can use regexp, but it IS an ugly, buggy and unstable idea.
Have I missed something in docs? How do I make per-class setup in
components?
Alex
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk