Class: Decidim::Notify::Permissions
- Inherits:
-
DefaultPermissions
- Object
- DefaultPermissions
- Decidim::Notify::Permissions
- Defined in:
- app/permissions/decidim/notify/permissions.rb
Instance Method Summary collapse
Instance Method Details
#edit_action? ⇒ Boolean
32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/permissions/decidim/notify/permissions.rb', line 32 def edit_action? return unless user case .action when :create, :update, :destroy component = context.fetch(:current_component) note_takers = Author.for(component).note_takers.pluck :decidim_user_id return allow! if note_takers.include? user.id end end |
#index_action? ⇒ Boolean
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/permissions/decidim/notify/permissions.rb', line 15 def index_action? return unless .action == :index component = context.fetch(:current_component) if component.settings.private return unless user participants = Author.for(component).pluck :decidim_user_id return allow! if participants.include? user.id elsif component.settings.restricted return allow! if user else allow! end end |
#permissions ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'app/permissions/decidim/notify/permissions.rb', line 6 def return unless .subject.in? [:notes, :chapter] index_action? edit_action? end |