Class: Pageflow::EntryPolicy Private

Inherits:
ApplicationPolicy show all
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

Instance Method Summary collapse

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

#queryObject (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

#userObject (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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


99
100
101
# File 'app/policies/pageflow/entry_policy.rb', line 99

def create?
  query.(: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.

Returns:

  • (Boolean)


95
96
97
# File 'app/policies/pageflow/entry_policy.rb', line 95

def create_any?
  AccountPolicy::Scope.new(@user, ).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.

Returns:

  • (Boolean)


152
153
154
# File 'app/policies/pageflow/entry_policy.rb', line 152

def destroy?
  
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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


79
80
81
# File 'app/policies/pageflow/entry_policy.rb', line 79

def index_widgets_for?
  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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


142
143
144
# File 'app/policies/pageflow/entry_policy.rb', line 142

def 
  query.(: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.

Returns:

  • (Boolean)


107
108
109
# File 'app/policies/pageflow/entry_policy.rb', line 107

def manage_translations?
  query.(: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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


128
129
130
# File 'app/policies/pageflow/entry_policy.rb', line 128

def 
  query.(: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.

Returns:

  • (Boolean)


59
60
61
# File 'app/policies/pageflow/entry_policy.rb', line 59

def read?
  preview?
end

#recordObject

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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


132
133
134
# File 'app/policies/pageflow/entry_policy.rb', line 132

def 
  
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.

Returns:

  • (Boolean)


146
147
148
149
150
# File 'app/policies/pageflow/entry_policy.rb', line 146

def update_feature_configuration_on?
  user.admin? ||
    (!permissions_config.only_admins_may_update_features &&
     )
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.

Returns:

  • (Boolean)


136
137
138
139
140
# File 'app/policies/pageflow/entry_policy.rb', line 136

def update_site_on?
  user.admin? ||
    (!permissions_config.only_admins_may_update_site &&
     )
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.

Returns:

  • (Boolean)


63
64
65
# File 'app/policies/pageflow/entry_policy.rb', line 63

def use_files?
  preview?
end