gobuffalo / buffalo-auth

Buffalo auth plugin helps adding username password authentication to your app
https://gobuffalo.io
MIT License
41 stars 28 forks source link

Split users to members and groups #23

Closed matrixik closed 1 year ago

matrixik commented 5 years ago

Hello, Thank you for creating this plugin.

If I wanted to split users to members and groups/teams where would be best place to start?

For reasons why not to have simple users (even at the beginning) in code: https://codewithoutrules.com/2018/09/21/users-considered-harmful/

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment. Otherwise, this will be closed in 7 days.

sio4 commented 1 year ago

Hi, I am not sure if you are still interested in this issue but I am going to add my comment here. (After that, I would like to close it but please feel free to reopen it if you have more questions or want to add more comments)

If I wanted to split users to members and groups/teams where would be best place to start?

To change the name "user" to "member" or something else, I would like to suggest you the following steps:

  1. scaffold with the command buffalo g auth
  2. find all filenames, structure names, or something else in the generated/modified files, and change them.

Having a group/team concept for the users cannot be easily simplified since there could be a bunch of possible options. You may want your user to have a single team like most traditional hierarchical organizations, or you may want your user to have a primary group and many other groups like Unix users (yes, I still use the word users), so you may need a 1:N relationship of N:N relationship with a primary flag (or with some other implementation). This is not the only consideration so you may need to design the whole service structure yourself.

Actually, this CLI plugin is for scaffolding of the start point and is not a final solution. I don't think users of this plugin just use the generated code as is.

For reasons why not to have simple users (even at the beginning) in code: https://codewithoutrules.com/2018/09/21/users-considered-harmful/

Well, even though I myself usually do not use the simple term "user" for my own system if there could be a possible complexity in the actor entities (yeah, I like the term member too), I do not agree with the document you mentioned. The "user" is just a word, giving meaning to the term is the job of the service owners/developers, replacing the word "user" with "member" (especially while keeping the concept) will not simply fix the issue :-) Also, sometimes a simple user concept with a role property or similar will be a better solution than having many different users with other names.