/[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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 22 by dpavlin, Fri May 26 18:35:08 2006 UTC revision 47 by dpavlin, Tue May 30 18:50:16 2006 UTC
# Line 18  use base qw/Transports::Record/; Line 18  use base qw/Transports::Record/;
18    
19  # Your model-specific methods go here.  # Your model-specific methods go here.
20    
 =head1 available_values  
   
 return all names  
   
 =cut  
   
 sub available_values {  
         my $self = shift;  
         return $self->column("name")->valid_values;  
 }  
   
21  =head2 current_user_can ACTION  =head2 current_user_can ACTION
22    
23  Let everybody create, read and update, but not delete.  Let everybody create, read and update, but not delete.
# Line 39  sub current_user_can { Line 28  sub current_user_can {
28      my $self = shift;      my $self = shift;
29      my $type = shift;      my $type = shift;
30    
31            return 1 if ($self->current_user->admin);
32    
33            return 1 if ($type eq 'read');
34    
35      # We probably want something like this eventually:      # We probably want something like this eventually:
36      if ($type =~ /(?:create|read|update)/i) {      if ($type =~ /(?:create|update)/i) {
37    
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          return 1;          return 1;
46      } else {      } else {
47          return $self->SUPER::current_user_can($type, @_);          return $self->SUPER::current_user_can($type, @_);

Legend:
Removed from v.22  
changed lines
  Added in v.47

  ViewVC Help
Powered by ViewVC 1.1.26