You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to Decidim::NeedsPermission#allowed_to?'s signature, we cannot pass in a user argument other than current_user without first passing extra_context and chain, even though we still want to use their defaults.
As a consequence, the calls to this method duplicate the permission_class_chain coupling views and other objects to it, which results in long lines and hampers changeability.
A potential solution could be to change #allowed_to? to use keyboard arguments instead so we can pass user only. If we do so, it needs to be a backward compatible-change for Decidim to accept it.
Due to
Decidim::NeedsPermission#allowed_to?
's signature, we cannot pass in auser
argument other thancurrent_user
without first passingextra_context
andchain
, even though we still want to use their defaults.As a consequence, the calls to this method duplicate the
permission_class_chain
coupling views and other objects to it, which results in long lines and hampers changeability.A potential solution could be to change
#allowed_to?
to use keyboard arguments instead so we can passuser
only. If we do so, it needs to be a backward compatible-change for Decidim to accept it.In the meantime, we could prepend somehow our own permissions class in https://github.com/decidim/decidim/blob/develop/decidim-consultations/app/controllers/decidim/consultations/application_controller.rb#L10-L13. If we go with the approach outlined in #19 of having our own controllers, we could just register a different chain that includes this new permissions class.
Originally posted by @microstudi in #15 (comment)
The text was updated successfully, but these errors were encountered: