DEFAULT_SELECT in Carto::User
See original GitHub issueFollow up from: https://github.com/CartoDB/cartodb/pull/9274/files/d2f647894deaf6a13188269d506a8f8bfbc22abc#r73366547
There, I proposed getting rid of DEFAULT_SELECT
in Carto::User
, as it is only used when following two associations: vis->user (DEFAULT_SELECT) and permission->user (SELECT_WITH_DATABASE). It makes reasoning about the code harder, because the model will have different fields loaded depending on where it comes from.
It is also the likely culprit of this issue: https://rollbar.com/vizzuality/CartoDB/items/19657/occurrences/14987729788/
You can see in the JSON for person
that the fields included there match the fields in DEFAULT_SELECT
. It should not happen though, because in that branch of the code, the user is extracted following layer->map->user, which should load the full user model. I don’t know why it sometimes, it only loads the default fields. AR caching maybe? I haven’t been able to consistently reproduce, it seems random.
This was originally introduced for security/performance. IMHO, performance should not be a problem (the DB has to load the entire disk page anyway) and security (regarding exposing private information) should not be handled here (it is the job of the controller/presenter). It only affected some associations anyway, so I feel the point is moot.
I think we should remove it as I don’t feel it is adding much, but makes the code harder to read and may be causing some issues.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (13 by maintainers)
Top GitHub Comments
I don’t agree on a). It’s a not big optimization that makes reasoning with code harder, so the tradeoff might pay at the most important associations but not at others. b) is true but we can’t remove many columns. There’s a lot of them that are only used in specific scenarios (that’s why we can select a projection for most of them), but only a couple are actually deprecated.
Removing columns is not a short term goal. I’d…
DEFAULT_SELECT
).Closing automatically because of inactivity. If anybody considers that this still important, please reopen and it’ll be prioritized.