Schema/ResultSet.pm untested

filter: Statementstmt 0.0% 0 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 18 CC 1 SCAR 6.9
CC
1
Cov
0%
guard
2.0
internal_columns
2.0
BEGIN
2.0
CRAP 2.0
1 package
2 Schema::ResultSet; # Hide from PAUSE. This is just an example.
3  
4 use strict;
5 use warnings;
6  
7 use base 'DBIx::Class::ResultSet';
8  
9  
10  
11 # TODO: DENY data access by default
12 # Descendants will override this with their own condition(s)
13 # Guard should restrict &create/&update to not create/update not owned data:
14 # create({ user_id => $another_user, name => ... }) -- here we create something for different user
15 # update({ user_id => $another_user }) -- our data is owned by different user
16 sub guard { return shift }
17  
18  
19  
20 sub internal_columns { return {} }
21  
22 1;
23  
24 =encoding utf8
25  
26 =head1 NAME
27  
28 Schema::ResultSet - Example base class for DBIx::Class resultsets
29  
30 =head1 DESCRIPTION
31  
32 This module is an example base class for resultsets in the shipped example
33 schema.
34  
35 It is designed to be overridden by real applications.
36  
37 =head1 METHODS
38  
39 =head2 guard
40  
41 my $rs = $rs->guard($context);
42  
43 In this distribution, C<guard> returns the resultset unchanged.
44  
45 Applications may override it to apply authorization filters based on the given
46 context (for example, a controller object).
47  
48 The L<D> helpers call C<guard> when operating in secure mode.
49  
50 =head2 internal_columns
51  
52 my $hashref = $rs->internal_columns;
53  
54 Return a hashref of column names that should be treated as internal. This is
55 used by L<D/columns_info> to exclude columns from returned metadata.
56  
57 =head1 SEE ALSO
58  
59 L<DBIx::Class::ResultSet>, L<Schema::Result>, L<D>
60  
61 =cut