Sha256: 6c0572d0240d7cdcba308d4fd5f1ed9427e78617a85c9b2e5e9cdaae74197279
Contents?: true
Size: 812 Bytes
Versions: 8
Compression:
Stored size: 812 Bytes
Contents
# frozen_string_literal: true module Decidim module Debates module Admin class Permissions < Decidim::DefaultPermissions def permissions # The public part needs to be implemented yet return permission_action if permission_action.scope != :admin return permission_action if permission_action.subject != :debate case permission_action.action when :create, :read allow! when :update toggle_allow(debate && !debate.closed? && debate.official?) when :delete, :close toggle_allow(debate && debate.official?) end permission_action end private def debate @debate ||= context.fetch(:debate, nil) end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems