/[transports]/trunk/lib/Transports/Model/Source.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/lib/Transports/Model/Source.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 47 - (hide annotations)
Tue May 30 18:50:16 2006 UTC (18 years ago) by dpavlin
File size: 1056 byte(s)
removed unused cruft
1 dpavlin 1 use strict;
2     use warnings;
3    
4     package Transports::Model::Source::Schema;
5     use Jifty::DBI::Schema;
6    
7     # Your column definitions go here. See L<Jifty::DBI::Schema> for
8     # documentation about how to write column definitions.
9    
10     column name =>
11     type is 'text',
12     label is 'Source client',
13     is mandatory,
14     since '0.0.6';
15    
16     package Transports::Model::Source;
17     use base qw/Transports::Record/;
18    
19     # Your model-specific methods go here.
20    
21 dpavlin 22 =head2 current_user_can ACTION
22    
23     Let everybody create, read and update, but not delete.
24    
25     =cut
26    
27     sub current_user_can {
28     my $self = shift;
29     my $type = shift;
30    
31 dpavlin 41 return 1 if ($self->current_user->admin);
32    
33 dpavlin 44 return 1 if ($type eq 'read');
34    
35 dpavlin 22 # We probably want something like this eventually:
36 dpavlin 44 if ($type =~ /(?:create|update)/i) {
37 dpavlin 36
38     my $uos = Transports::Model::UserOnSource->new();
39     $uos->load_by_cols(
40     user_on => $self->current_user->id,
41     source => $self->id
42     );
43     return undef if ($self->current_user->id && ! $uos->id);
44    
45 dpavlin 22 return 1;
46     } else {
47     return $self->SUPER::current_user_can($type, @_);
48     }
49     }
50    
51 dpavlin 1 1;
52    

  ViewVC Help
Powered by ViewVC 1.1.26