Unify Security Configuration page - Move presenter to FOSS
This is an implementation issue for #339023 (closed)
Why are we doing this work
The Security Configuration page needs to show different information depending on the tier the given project is in. Currently, the logic of that behaviour is scattered in various places on the frontend and backend, which makes adding features or moving features to different tiers difficult and error-prone.
For instance, there's a check in the EE::Projects::Security::ConfigurationController
that's a proxy for "are we in Ultimate?", and delegates to the CE controller in the negative case. That controller passes basically no information to the frontend (there's no ConfigurationPresenter
instance exposed), and so the frontend has to branch on that, and hard-code some information and have some awkward type checks.
Instead, it would be better if the Security::ConfigurationController
always presented the same structured information to the frontend. Then, the frontend could be simplified to render the information it's given, rather than making decisions itself about what to do given the lack of data. Modifications to the frontend are covered by #333113 (closed).
In short, this would make adding to and modifying the Security Configuration page much simpler and faster.
Relevant links
Implementation plan
-
Create FOSS Security::ConfigurationPresenter
class inapp/presenters/projects/security
. (FOSS class for reference) -
Convert existing EE Security::ConfigurationPresenter
to module and move it to `ee/app/presenters/ee/projects/security' and prepend FOSS class with this module. (EE module for reference) -
Move to FOSS class all public methods to_h
,to_html_data_attribute
. -
in to_h
method remove all fields that are required by EE: all related to auto-fix feature (auto_fix_enabled
,can_toggle_auto_fix_settings
,auto_fix_user_path
) -
Add those auto-fix fields to the EE module version of to_h
and merge them withsuper
Testing
To be implicitly tested by UI focused E2E tests (package-and-qa / master pipeline onwards)