loopback-example-access-control icon indicating copy to clipboard operation
loopback-example-access-control copied to clipboard

Refactor `user` to another name

Open superkhau opened this issue 9 years ago • 10 comments
trafficstars

We get a lot of confusion from my original implementation of user extending builtin User. We should rename it to something like CustomUser or something to signify it's obviously not the same as builtin User.

superkhau avatar Mar 01 '16 19:03 superkhau

Thanks for reporting that ;)

The official documentation tells us to use Customer or Client when overriding the User model. Moreover, I am not conviced that mixing naming conventions in the example is a good practice.

https://docs.strongloop.com/display/public/LB/Managing+users

timotheemoulin avatar Apr 05 '16 20:04 timotheemoulin

Do you have any suggestions? :ear:

superkhau avatar Apr 05 '16 21:04 superkhau

I think that using the same names as in the official documentation Customer, Client would be a good idea. I might highy help people understanding the examples.

timotheemoulin avatar Apr 05 '16 21:04 timotheemoulin

Haha, actually user was the official name before and we added Customer/Client because we had to keep explaining it before, but never got around to updating the examples to match. ;) I think we'll go with Customer because Client will probably cause other issues down the line. Thanks for the feedback.

superkhau avatar Apr 05 '16 23:04 superkhau

Ok I get it.

I don't mind using User twice. That's even what I would have done if not told otherwise in the doc. What bother me more is that it's once written in lowercase and the second time with an uppercase U

timotheemoulin avatar Apr 05 '16 23:04 timotheemoulin

No, it has to be lowercase or it will conflict with the builtin User model. That or you can name it something other than "User".

superkhau avatar Apr 06 '16 00:04 superkhau

the User vs user issue also breaks down if you use mysql as a backend, since it can't distinguish between tables by case.

DaGaMs avatar May 03 '16 22:05 DaGaMs

Account seems to be distinguishable enough and independent from actual user purpose (Client, Customer etc)

antarasi avatar Oct 17 '16 18:10 antarasi

Would someone like to submit a PR? I can help with the landing. ;)

superkhau avatar Oct 17 '16 21:10 superkhau

I addressed this issue in a new PR

csakis avatar Dec 19 '17 23:12 csakis