return {
session => 1,
- roles => 1,
+ roles => {
+ self_check => $self->config->{check_roles} || 0,,
+ self_check_any => $self->config->{check_roles_any} || 0,
+ },
};
}
+#will only be used if $config->{check_roles} is set
+sub check_roles {
+ my ( $self, @wanted_roles ) = @_;
+
+ my @roles = $self->roles;
+ my $name = $self->config->{check_roles};
+
+ return $self->_user->$name( \@roles, \@wanted_roles );
+}
+
+#will only be used if $config->{check_roles_any} is set
+sub check_roles_any {
+ my ( $self, @wanted_roles ) = @_;
+
+ my @roles = $self->roles;
+ my $name = $self->config->{check_roles_any};
+
+ return $self->_user->$name( \@roles, \@wanted_roles );
+}
sub roles {
my ( $self ) = shift;
Delegates handling of the C<< can >> method to the underlying user row.
+=head2 check_roles
+
+Calls the specified check_roles method on the underlying user row.
+
+Passes \@roles, \@wanted_roles, where @roles is the list of roles,
+and @wanted_roles is the list of wanted roles
+
+=head2 check_roles_any
+
+Calls the specified check_roles_any method on the underlying user row.
+
+Passes \@roles, \@wanted_roles, where @roles is the list of roles,
+and @wanted_roles is the list of wanted roles
+
=head1 BUGS AND LIMITATIONS
None known currently, please email the author if you find any.