/[Grep]/lib/Grep/Model/Feed.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 /lib/Grep/Model/Feed.pm

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

revision 37 by dpavlin, Tue Feb 20 10:32:30 2007 UTC revision 70 by dpavlin, Thu Feb 22 17:59:56 2007 UTC
# Line 5  package Grep::Model::Feed; Line 5  package Grep::Model::Feed;
5  use Jifty::DBI::Schema;  use Jifty::DBI::Schema;
6    
7  use Feed::Find;  use Feed::Find;
8    use Scalar::Defer;
9    use Grep::Model::User;
10    
11  use Grep::Record schema {  use Grep::Record schema {
12    
# Line 12  use Grep::Record schema { Line 14  use Grep::Record schema {
14                  type is 'text',                  type is 'text',
15                  label is 'URI',                  label is 'URI',
16                  hints is 'Replace search string in URI with %s (grep will be replaced automatically)',                  hints is 'Replace search string in URI with %s (grep will be replaced automatically)',
17                  is mandatory,                  is mandatory;
                 distinct;  
18    
19          column title =>          column title =>
20                  type is 'text',                  type is 'text',
# Line 28  use Grep::Record schema { Line 29  use Grep::Record schema {
29                  hints are 'If you leave Cookie data Grep will impersonate you to feed provider!',                  hints are 'If you leave Cookie data Grep will impersonate you to feed provider!',
30                  since '0.0.3';                  since '0.0.3';
31    
32            column owner =>
33                    refers_to Grep::Model::User by 'id',
34                    label is 'Feed owner',
35                    default is defer { Jifty->web->current_user->id },
36                    since '0.0.5';
37    
38            column created_on =>
39                    type is 'timestamp',
40                    label is 'Created On',
41                    default is defer { DateTime->now },
42                    filters are 'Jifty::DBI::Filter::DateTime',
43                    since '0.0.5';
44    
45  };  };
46    
47  sub since { '0.0.1' }  sub since { '0.0.1' }
# Line 57  sub current_user_can { Line 71  sub current_user_can {
71          my $self = shift;          my $self = shift;
72          my $what = shift;          my $what = shift;
73    
74          Jifty->log->debug("current_user_can($what) on feed ", $self->id);          my $uid = Jifty->web->current_user->id;
75    
76            return 1 if ( $uid && $what eq 'create' );
77    
78            return 1 if ( $uid && ! $self->id );
79    
80    #       Jifty->log->debug("current_user[$uid]_can($what) on Feed ", $self->id || '???', " owner ", $self->owner->id || '???');
81    
82            return 1 if ( $uid == $self->owner->id );
83    
         return 1 if Jifty->web->current_user->id;  
84  }  }
85    
86  1;  1;

Legend:
Removed from v.37  
changed lines
  Added in v.70

  ViewVC Help
Powered by ViewVC 1.1.26