DBIC/User/CDBI.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 47 CC 3 SCAR 19.5
CC
3
Cov
0%
_role_search
12.0
store_session_data
2.0
BEGIN
2.0
CRAP 7.0
1 package # (mst) I don't have perms to this and it's a final deprecation release
2 Catalyst::Plugin::Authentication::Store::DBIC::User::CDBI;
3 use strict;
4 use base qw/Catalyst::Plugin::Authentication::Store::DBIC::User/;
5  
6 sub store_session_data {
7 my ( $self, $data ) = @_;
8 my $col = $self->config->{auth}{session_data_field};
9 my $obj = $self->obj;
10
11 my $dbh = $obj->db_Main;
12 local $dbh->{AutoCommit};
13 $dbh->begin_work;
14 $obj->$col($data);
15 $obj->update;
16 $dbh->commit;
17 }
18  
19 # slow Class::DBI method
20 # Retrieve only as many roles as necessary to fail the check
21 sub _role_search {
22 my ($self, @wanted_roles) = @_;
23 my $cfg = $self->config->{authz};
24 my $role_field = $cfg->{role_field};
25 $cfg->{user_role_role_field} ||= $role_field;
26  
27 my @roles;
28 for my $role ( @wanted_roles ) {
29 if (my $role_obj = $cfg->{role_class}->search(
30 { $role_field => $role } )->first)
31 {
32 if ( $cfg->{user_role_class}->search( {
33 $cfg->{user_role_user_field} => $self->obj->id,
34 $cfg->{user_role_role_field} => $role_obj->id,
35 } ) )
36 {
37 push @roles, $role;
38 } else {
39 last;
40 }
41 } else {
42 last;
43 }
44 }
45  
46 return @roles;
47 }
48  
49 1;