47 |
|
|
48 |
# Your model-specific methods go here. |
# Your model-specific methods go here. |
49 |
|
|
50 |
|
sub current_user_can { |
51 |
|
my $self = shift; |
52 |
|
my $what = shift; |
53 |
|
|
54 |
|
my $uid = Jifty->web->current_user->id; |
55 |
|
|
56 |
|
return 1 if ( $uid && $what eq 'create' ); |
57 |
|
|
58 |
|
return 1 if ( $uid && ! $self->id ); |
59 |
|
|
60 |
|
my $owner_id = $self->in_feed->owner->id; |
61 |
|
|
62 |
|
# Jifty->log->debug("current_user[$uid]_can($what) on Item ", $self->id || '???', " owner ", $owner_id || '???'); |
63 |
|
|
64 |
|
return 1 if ( $uid && $uid == $owner_id ); |
65 |
|
} |
66 |
|
|
67 |
1; |
1; |
68 |
|
|