1 |
dpavlin |
1 |
use strict; |
2 |
|
|
use warnings; |
3 |
|
|
|
4 |
|
|
package Transports::Model::Destination::Schema; |
5 |
|
|
use Jifty::DBI::Schema; |
6 |
|
|
|
7 |
|
|
column name => |
8 |
|
|
type is 'text', |
9 |
|
|
label is 'Destination client', |
10 |
|
|
is mandatory, |
11 |
|
|
since '0.0.7'; |
12 |
|
|
|
13 |
|
|
# Your column definitions go here. See L<Jifty::DBI::Schema> for |
14 |
|
|
# documentation about how to write column definitions. |
15 |
|
|
|
16 |
|
|
package Transports::Model::Destination; |
17 |
|
|
use base qw/Transports::Record/; |
18 |
|
|
|
19 |
|
|
# Your model-specific methods go here. |
20 |
|
|
|
21 |
|
|
sub available_values { |
22 |
|
|
my $self = shift; |
23 |
|
|
return $self->column("name")->valid_values; |
24 |
|
|
} |
25 |
|
|
|
26 |
dpavlin |
22 |
=head2 current_user_can ACTION |
27 |
|
|
|
28 |
|
|
Let everybody create, read and update, but not delete. |
29 |
|
|
|
30 |
|
|
=cut |
31 |
|
|
|
32 |
|
|
sub current_user_can { |
33 |
|
|
my $self = shift; |
34 |
|
|
my $type = shift; |
35 |
|
|
|
36 |
|
|
# We probably want something like this eventually: |
37 |
|
|
if ($type =~ /(?:create|read|update)/i) { |
38 |
|
|
return 1; |
39 |
|
|
} else { |
40 |
|
|
return $self->SUPER::current_user_can($type, @_); |
41 |
|
|
} |
42 |
|
|
} |
43 |
|
|
|
44 |
dpavlin |
1 |
1; |
45 |
|
|
|