File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ def find_paste_and_project
100
100
else
101
101
@pastes = Paste
102
102
end
103
- @pastes = @pastes . insecure
103
+ @pastes = @pastes . visible_to ( User . current )
104
104
105
105
if params [ :id ] . present?
106
106
if Paste . secure_id? ( params [ :id ] )
Original file line number Diff line number Diff line change @@ -31,7 +31,9 @@ class Paste < ActiveRecord::Base
31
31
}
32
32
33
33
named_scope :secure , :conditions => "access_token IS NOT NULL"
34
- named_scope :insecure , :conditions => "access_token IS NULL"
34
+ named_scope :visible_to , lambda { |user |
35
+ { :conditions => ( user . admin? ? nil : [ "access_token IS NULL OR author_id = ?" , user . id ] ) }
36
+ }
35
37
36
38
named_scope :expired , :conditions => "expires_at <= current_timestamp"
37
39
default_scope :conditions => "expires_at IS NULL OR expires_at > current_timestamp"
You can’t perform that action at this time.
0 commit comments