Class: Pageflow::EntryPolicy Private
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- Pageflow::EntryPolicy
- Defined in:
- app/policies/pageflow/entry_policy.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: Scope
Instance Attribute Summary collapse
- #query ⇒ Object readonly private
- #user ⇒ Object readonly private
Instance Method Summary collapse
- #add_member_to? ⇒ Boolean private
- #confirm_encoding? ⇒ Boolean private
- #create? ⇒ Boolean private
- #create_any? ⇒ Boolean private
- #destroy? ⇒ Boolean private
- #destroy_membership_on? ⇒ Boolean private
- #duplicate? ⇒ Boolean private
- #edit? ⇒ Boolean private
- #edit_outline? ⇒ Boolean private
- #edit_role_on? ⇒ Boolean private
- #filter_by_type? ⇒ Boolean private
- #index_widgets_for? ⇒ Boolean private
-
#initialize(user, entry) ⇒ EntryPolicy
constructor
private
A new instance of EntryPolicy.
- #manage? ⇒ Boolean private
- #manage_account_of? ⇒ Boolean private
- #manage_translations? ⇒ Boolean private
- #preview? ⇒ Boolean private
- #publish? ⇒ Boolean private
- #publish_on_account_of? ⇒ Boolean private
- #read? ⇒ Boolean private
- #record ⇒ Object private
- #restore? ⇒ Boolean private
- #snapshot? ⇒ Boolean private
- #update_account_on? ⇒ Boolean private
- #update_feature_configuration_on? ⇒ Boolean private
- #update_site_on? ⇒ Boolean private
- #use_files? ⇒ Boolean private
Constructor Details
#initialize(user, entry) ⇒ EntryPolicy
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of EntryPolicy.
41 42 43 44 45 |
# File 'app/policies/pageflow/entry_policy.rb', line 41 def initialize(user, entry) @user = user @entry = entry @query = EntryRoleQuery.new(user, entry) end |
Instance Attribute Details
#query ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'app/policies/pageflow/entry_policy.rb', line 39 def query @query end |
#user ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'app/policies/pageflow/entry_policy.rb', line 39 def user @user end |
Instance Method Details
#add_member_to? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
116 117 118 |
# File 'app/policies/pageflow/entry_policy.rb', line 116 def add_member_to? manage? end |
#confirm_encoding? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
71 72 73 |
# File 'app/policies/pageflow/entry_policy.rb', line 71 def confirm_encoding? edit? end |
#create? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
99 100 101 |
# File 'app/policies/pageflow/entry_policy.rb', line 99 def create? query.has_at_least_account_role?(:publisher) end |
#create_any? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
95 96 97 |
# File 'app/policies/pageflow/entry_policy.rb', line 95 def create_any? AccountPolicy::Scope.new(@user, Account).entry_creatable.any? end |
#destroy? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
152 153 154 |
# File 'app/policies/pageflow/entry_policy.rb', line 152 def destroy? manage_account_of? end |
#destroy_membership_on? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
124 125 126 |
# File 'app/policies/pageflow/entry_policy.rb', line 124 def destroy_membership_on? manage? end |
#duplicate? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
103 104 105 |
# File 'app/policies/pageflow/entry_policy.rb', line 103 def duplicate? query.has_at_least_role?(:publisher) end |
#edit? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
67 68 69 |
# File 'app/policies/pageflow/entry_policy.rb', line 67 def edit? query.has_at_least_role?(:editor) end |
#edit_outline? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
75 76 77 |
# File 'app/policies/pageflow/entry_policy.rb', line 75 def edit_outline? edit? end |
#edit_role_on? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
120 121 122 |
# File 'app/policies/pageflow/entry_policy.rb', line 120 def edit_role_on? manage? end |
#filter_by_type? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 |
# File 'app/policies/pageflow/entry_policy.rb', line 51 def filter_by_type? user.admin? end |
#index_widgets_for? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
79 80 81 |
# File 'app/policies/pageflow/entry_policy.rb', line 79 def edit? end |
#manage? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
111 112 113 114 |
# File 'app/policies/pageflow/entry_policy.rb', line 111 def manage? user.admin? || query.has_at_least_role?(:manager) end |
#manage_account_of? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
142 143 144 |
# File 'app/policies/pageflow/entry_policy.rb', line 142 def manage_account_of? query.has_at_least_account_role?(:manager) end |
#manage_translations? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
107 108 109 |
# File 'app/policies/pageflow/entry_policy.rb', line 107 def manage_translations? query.has_at_least_account_role?(:publisher) end |
#preview? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
55 56 57 |
# File 'app/policies/pageflow/entry_policy.rb', line 55 def preview? query.has_at_least_role?(:previewer) end |
#publish? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
91 92 93 |
# File 'app/policies/pageflow/entry_policy.rb', line 91 def publish? query.has_at_least_role?(:publisher) end |
#publish_on_account_of? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
128 129 130 |
# File 'app/policies/pageflow/entry_policy.rb', line 128 def publish_on_account_of? query.has_at_least_account_role?(:publisher) end |
#read? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
59 60 61 |
# File 'app/policies/pageflow/entry_policy.rb', line 59 def read? preview? end |
#record ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'app/policies/pageflow/entry_policy.rb', line 47 def record @entry end |
#restore? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
83 84 85 |
# File 'app/policies/pageflow/entry_policy.rb', line 83 def restore? edit? end |
#snapshot? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
87 88 89 |
# File 'app/policies/pageflow/entry_policy.rb', line 87 def snapshot? edit? end |
#update_account_on? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
132 133 134 |
# File 'app/policies/pageflow/entry_policy.rb', line 132 def update_account_on? publish_on_account_of? end |
#update_feature_configuration_on? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
146 147 148 149 150 |
# File 'app/policies/pageflow/entry_policy.rb', line 146 def update_feature_configuration_on? user.admin? || (!.only_admins_may_update_features && manage_account_of?) end |
#update_site_on? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
136 137 138 139 140 |
# File 'app/policies/pageflow/entry_policy.rb', line 136 def update_site_on? user.admin? || (!.only_admins_may_update_site && publish_on_account_of?) end |
#use_files? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
63 64 65 |
# File 'app/policies/pageflow/entry_policy.rb', line 63 def use_files? preview? end |