/[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 57 by dpavlin, Mon Jun 5 14:06:58 2006 UTC revision 58 by dpavlin, Mon Jun 5 15:21:18 2006 UTC
# Line 27  use base qw/Transports::Record/; Line 27  use base qw/Transports::Record/;
27    
28  =head2 current_user_can ACTION  =head2 current_user_can ACTION
29    
30  Everybody can read, admin and import can everything else.  admin and import can everything, users with permission on landscape can read.
31    
32  =cut  =cut
33    
# Line 35  sub current_user_can { Line 35  sub current_user_can {
35      my $self = shift;      my $self = shift;
36      my $type = shift;      my $type = shift;
37    
38          return 1 if ($type eq 'read' || $self->current_user->admin || $self->current_user->can_import);          return 1 if ($self->current_user->admin || $self->current_user->can_import);
39    
40            if ($type eq 'read') {
41    
42                    my $l = Transports::Model::UserOnLandscape->new();
43                    $l->load_by_cols(
44                            user_on => $self->current_user->id,
45                            landscape => $self->landscape->id,
46                    );
47    
48                    if ($l->id) {
49                            return 1;
50                    } else {
51                            return undef;
52                    }
53            }
54    
55          return $self->SUPER::current_user_can($type, @_);          return $self->SUPER::current_user_can($type, @_);
56  }  }

Legend:
Removed from v.57  
changed lines
  Added in v.58

  ViewVC Help
Powered by ViewVC 1.1.26