Sha256: d36c04708889540f2edc81b6f4fb40559205fafe8c91714b99d7a46a327db478
Contents?: true
Size: 840 Bytes
Versions: 11
Compression:
Stored size: 840 Bytes
Contents
# frozen_string_literal: true module Decidim module Debates class Permissions < Decidim::DefaultPermissions def permissions # Delegate the admin permission checks to the admin permissions class return Decidim::Debates::Admin::Permissions.new(user, permission_action, context).permissions if permission_action.scope == :admin return permission_action if permission_action.scope != :public return permission_action if permission_action.subject != :debate case permission_action.action when :create toggle_allow(can_create_debate?) when :report allow! end permission_action end private def can_create_debate? authorized?(:create) && current_settings&.creation_enabled? end end end end
Version data entries
11 entries across 11 versions & 1 rubygems