sails-permissions icon indicating copy to clipboard operation
sails-permissions copied to clipboard

Owner / createdBy not working on all models

Open dottodot opened this issue 10 years ago • 6 comments
trafficstars

For some reason only some of my models are being populated with the owner and createdBy attributes and I've not set autoCreatedBy to false anywhere. Is there any other reason why this would be happening?

dottodot avatar Sep 09 '15 07:09 dottodot

Depending on which version of sails-permissions you are using, owner is not always set on the models. createdBy should be more consistent. Do you have any more information about which models get owner/createdBy and which don't? Are the ones that aren't getting owner/createdBy being created through the rest api?

ryanwilliamquinn avatar Sep 10 '15 01:09 ryanwilliamquinn

I'm using v1.4.4

I have a backbone app so yes it is using a rest api but the creation of models on ones that do and don't have the owner/createdBy are handled by a Sails Controller anyway i.e Model.create

I've been using sails-permissions on this app for some time so could there be something left from a previous version causing it not to work.

Also are there any guidelines as to when and why a owner get added as it's a bit confusing when it's not consistent.

dottodot avatar Sep 10 '15 07:09 dottodot

On previous versions, owner was only created if it was set manually, but that was changed in a recent pull request: https://github.com/tjwebb/sails-permissions/pull/118

Looks like the first version it was included was 1.4.0

ryanwilliamquinn avatar Sep 11 '15 01:09 ryanwilliamquinn

i have a question, why do we use owner instead of createdBy aren't they synonymous.

mikedevita avatar Sep 13 '15 01:09 mikedevita

Theoretically, the owner of an object does not necessarily have to be the entity that created it.

ryanwilliamquinn avatar Sep 13 '15 02:09 ryanwilliamquinn

@dottodot is this still an open issue?

ryanwilliamquinn avatar Oct 11 '15 14:10 ryanwilliamquinn