Sha256: 22a82d37a4efe52453fff147d8876a0764113b5f79553bb92f792a3b310d8218
Contents?: true
Size: 835 Bytes
Versions: 1
Compression:
Stored size: 835 Bytes
Contents
# frozen_string_literal: true module Decidim::Assemblies::PermissionsDecorator def self.decorate Decidim::Assemblies::Permissions.class_eval do # Intercept the `has_manageable_assemblies?` method # always returns true if the user is a department_admin. Otherwise delegates to the original method. # This is a fix to avoid permissions crashing when there are no assemblies with the user's area. alias_method :original_has_manageable_assemblies?, :has_manageable_assemblies? # rubocop: disable Lint/UnusedMethodArgument def has_manageable_assemblies?(role: :any) return unless user user.department_admin? || original_has_manageable_assemblies? end # rubocop: enable Lint/UnusedMethodArgument end end end ::Decidim::Assemblies::PermissionsDecorator.decorate
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-department_admin-0.7.2 | app/decorators/decidim/assemblies/permissions_decorator.rb |