--- trunk/lib/Transports/Model/Destination.pm 2006/06/05 14:06:58 51 +++ trunk/lib/Transports/Model/Destination.pm 2006/06/05 15:21:18 58 @@ -28,7 +28,7 @@ =head2 current_user_can ACTION -Let everybody create, read and update, but not delete. +admin and import can everything, users with permission on landscape can read. =cut @@ -36,12 +36,23 @@ my $self = shift; my $type = shift; - # We probably want something like this eventually: - if ($type =~ /(?:create|read|update)/i) { - return 1; - } else { - return $self->SUPER::current_user_can($type, @_); - } + return 1 if ($self->current_user->admin || $self->current_user->can_import); + + if ($type eq 'read') { + + my $l = Transports::Model::UserOnLandscape->new(); + $l->load_by_cols( + user_on => $self->current_user->id, + landscape => $self->landscape->id, + ); + + if ($l->id) { + return 1; + } else { + return undef; + } + } + } 1;