JKHeadley / appy-backend

A user system to bootstrap your app.
https://appyapp.io
MIT License
108 stars 30 forks source link

createdBy field #8

Closed plmercereau closed 7 years ago

plmercereau commented 7 years ago

Hello Justin and al, First of all congratulations on the outstanding repository you shared! Very useful, thanks very much. I was wondering if you planned to develop a createdBy and updatedBy functionality so we can keep track on the authors of the documents. I guess this could be linked with the automatic logging/auditing thing that is already on the rest-hapi roadmap? Thanks! Pierre

JKHeadley commented 7 years ago

@plmercereau, thanks for your interest! Yes, in preliminary versions of rest-hapi this information was included as part of the automatic auditing system, and we would like to include it as part of rest-hapi as well. However, there is also the option of including these as part of each document, similar to the createdAt and updatedAt fields. We appreciate any input as to which would be more useful to you.

It might be the case that these features would not be a good fit for rest-hapi integration, given that there is no default sense of a "user" within rest-hapi, however I would think that at the very least this could be integrated within the appy system.

plmercereau commented 7 years ago

Hello Justin, Thanks for your reply, and sorry for the delay. Indeed I would make more sense to have such functionality in Appy rather than in the core rest-hapi module. I must clarify what I have in mind indeed: although there is already a clear and promissing role and permissions system, such field could be the first step to sharpen the persmissions at the document level, e.g. to allow to a specific user to be the only one to have write access to the documents he created, and read-only access for the other authenticated users, or another and more advanced example would be to link documents with groups or roles, so only the users of this group or having this role have the permissions to this document. There is a compenent that seems to implement such a functionality for Loopback. I hope this input gives you some ideas on what could be added in your outstanding repositories - unfortunately I am too much of a newbie in JS so I won't be of any help to contribute... Cheers

JKHeadley commented 7 years ago

Thanks for those ideas! I agree that would be a very useful feature and seems to me to be a natural evolution of the permissions system. This is difficult to do directly with the hapi scope system, but I am looking into how this might be accomplished with a tool such as the mrhorse policy plugin:

https://github.com/mark-bradshaw/mrhorse

Please feel free to mention any future feature requests that you believe would be helpful.

JKHeadley commented 7 years ago

@plmercereau as an update, many of these features were included in the most recent version (v0.29.0 )of rest-hapi, and therefore should be accessible through appy. I plan to add some example functionality in appy in the near future. Please see the rest-hapi changelog for links to new feature documentation.

Thanks again for all your suggestions!

JKHeadley commented 7 years ago

Added with JKHeadley/rest-hapi#65