File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -36,24 +36,22 @@ class Paste < ActiveRecord::Base
36
36
scope :unexpired , where ( "expires_at IS NULL OR expires_at > current_timestamp" )
37
37
38
38
#
39
- # * Restrict to projects where the user is a member with a role
40
- # allowing to view pastes.
39
+ # * Restrict to projects where the user has a role allowing to view
40
+ # pastes.
41
41
#
42
42
# * Restrict to specific project, if given.
43
43
#
44
- # * Admin users should be able to see all pastes, even secure ones)
44
+ # * Admin users should be able to see all pastes, even secure ones.
45
45
#
46
46
# * An ordinary user can see a secure paste only if he has authored it.
47
47
#
48
48
# * Never show expired pastes even to an admin.
49
49
#
50
50
scope :visible , lambda { |user = User . current , *args |
51
51
o = args . first || { }
52
- o = o . merge ( :member => true )
53
52
54
- s = self
53
+ s = where ( Project . allowed_to_condition ( user , :view_pastes , o ) ) . includes ( :project )
55
54
unless user . admin?
56
- s = s . where ( Project . allowed_to_condition ( user , :view_pastes , o ) ) . includes ( :project )
57
55
s = s . where ( [ "access_token IS NULL OR author_id = ?" , user . id ] )
58
56
end
59
57
s . unexpired
You can’t perform that action at this time.
0 commit comments