1 |
use strict; |
2 |
use warnings; |
3 |
|
4 |
package Transports::Model::Source::Schema; |
5 |
use Jifty::DBI::Schema; |
6 |
|
7 |
use Transports::Model::Landscape; |
8 |
|
9 |
# Your column definitions go here. See L<Jifty::DBI::Schema> for |
10 |
# documentation about how to write column definitions. |
11 |
|
12 |
column name => |
13 |
type is 'text', |
14 |
label is 'Source client', |
15 |
is mandatory, |
16 |
since '0.0.6'; |
17 |
|
18 |
column landscape => |
19 |
refers_to Transports::Model::Landscape, |
20 |
label is 'Part of landscape', |
21 |
since '0.0.13'; |
22 |
|
23 |
package Transports::Model::Source; |
24 |
use base qw/Transports::Record/; |
25 |
|
26 |
# Your model-specific methods go here. |
27 |
|
28 |
=head2 current_user_can ACTION |
29 |
|
30 |
Everybody can read, admin and import can everything else. |
31 |
|
32 |
=cut |
33 |
|
34 |
sub current_user_can { |
35 |
my $self = shift; |
36 |
my $type = shift; |
37 |
|
38 |
return 1 if ($type eq 'read' || $self->current_user->admin || $self->current_user->can_import); |
39 |
|
40 |
return $self->SUPER::current_user_can($type, @_); |
41 |
} |
42 |
|
43 |
1; |
44 |
|