roadmap
roadmap copied to clipboard
Migrate off of FlagShihTzu gem
The FlagShihTzu gem (which is used for bit field like user roles) is no longer maintained. It's not supposed to be compatible with Ruby 3 & Rails 6 : https://github.com/pboling/flag_shih_tzu#prerequisites
There is another one out there called bitfields but its also no longer maintained.
Here are the models and attributes that currently make use of a FlagShihTzu bitfield: contributor.roles, identifier_scheme.context, org.org_type, role.access.
After looking at these, I think we have 3 options.
- Take over maintenance of the FlagShihTzu gem ourselves. I doubt any of us has the bandwidth to do that though
- Build our own Bitfield Rails concern. Perhaps patterning it off of this example
- Update those 4 models so that we don't need the complexity of a Bitfield.
- The Contributor model's
rolescould be moved to a table in their own right calledcontributor_rolesthat stores a label and the URL identifier (we currently add the Credit taxonomy URL base to the value in the API presenters, it would be more efficient to just have it in the table). This seems like an appropriate path for this one as it will allow more flexibility for instances of the code base to manage what roles they want to provide - The Identifier Scheme's
contextcould simply become a couple of boolean flags on the table instead of a bitfield. The values in this bitfield are really used to help fetch the appropriate identifiers - The Org's
org_typecould probably be replaced by a singleis_funderboolean on the table. The data model has always had these different org types, but the only one that has any practical bearing on the code is whether or not the Org is a funder. - The Role's
accesscould likely become a single enum (int) field. I'm not sure why it was ever broken up into so many options. A user is either the owner, an admin, an editor or a commenter. The current setup is complexity we do not really need.
- The Contributor model's
@johnpinto1 found this page that compares the available gems: https://www.ruby-toolbox.com/categories/Active_Record_Bit_Fields