Sha256: 63c9635a97fbd89d0ac9cb6fa24eeed112c0eb0ecc5ef0518e960c092a6f4025
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
# frozen_string_literal: true module Decidim module Plans module Admin class Permissions < Decidim::DefaultPermissions def permissions return permission_action unless user return permission_action if permission_action.scope != :admin toggle_allow(admin_plan_answering_is_enabled?) if permission_action.action == :create && permission_action.subject == :plan_answer return permission_action if permission_action.subject != :plan && permission_action.subject != :plans && permission_action.subject != :section && permission_action.subject != :sections case permission_action.action when :create permission_action.allow! when :edit, :update, :destroy permission_action.allow! if plan.present? || section.present? when :close permission_action.allow! if plan.present? end permission_action end private def plan @plan ||= context.fetch(:plan, nil) end def admin_plan_answering_is_enabled? current_settings.try(:plan_answering_enabled) && component_settings.try(:plan_answering_enabled) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-plans-0.16.1 | app/permissions/decidim/plans/admin/permissions.rb |