I trying simple example from loopback doc, already read Why Principal is not a model, but Role, RoleMapping, ACL are suddenly models?
But still can't understand from where exactly principals come from. I searched all loopback code and still, can't find it. All I can say principals is some kind of abstraction.
And back to the code:
module.exports = function(create) {
create.models.User.create([{email: '', password: ''},
{email: '', password: ''}], function(users) {;
create.models.Role.create({name: 'Product'}, function(product) {;
product.principals.create({ principalType: create.models.RoleMapping.USER, principalId: users[1].id}, function(mainproduct) {;
});
});
});
};
Node on start gives TypeError: Cannot read property 'create' of undefined
for principals, and I have no idea what to define for principals
AI, human or vice principals, please reply!
via Anonymous
No comments:
Post a Comment