File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44# Note the method names here correspond with controller actions
55class PublicPagePolicy < ApplicationPolicy
66 # rubocop:disable Lint/MissingSuper
7- def initialize ( object , object2 = nil )
8- @object = object
9- @object2 = object2
7+ def initialize ( user , record = nil )
8+ @user = user
9+ @record = record
1010 end
1111 # rubocop:enable Lint/MissingSuper
1212
@@ -19,19 +19,18 @@ def template_index?
1919 end
2020
2121 def template_export?
22- @object . present? && @object2 . published?
22+ @user . present? && @record . published?
2323 end
2424
2525 def plan_export?
26- @object2 . publicly_visible?
26+ @record . publicly_visible?
2727 end
2828
2929 def plan_organisationally_exportable?
30- plan = @object
31- user = @object2
32- if plan . is_a? ( Plan ) && user . is_a? ( User )
33- return plan . publicly_visible? || ( plan . organisationally_visible? && plan . owner . present? &&
34- plan . owner . org_id == user . org_id )
30+ if @record . is_a? ( Plan ) && @user . is_a? ( User )
31+ return @record . publicly_visible? ||
32+ ( @record . organisationally_visible? && @record . owner . present? &&
33+ @record . owner . org_id == @user . org_id )
3534 end
3635
3736 false
You can’t perform that action at this time.
0 commit comments