Skip to content

Instantly share code, notes, and snippets.

@ndhoule
Last active August 29, 2015 14:01
Show Gist options
  • Save ndhoule/8d35cd21b0bceb57dcec to your computer and use it in GitHub Desktop.
Save ndhoule/8d35cd21b0bceb57dcec to your computer and use it in GitHub Desktop.
// config/policies.js
module.exports = {
'*': false,
user: {
create: true,
find: true,
update: true,
destroy: true
},
role: {
create: true,
find: true,
update: true,
destroy: true
}
};
// api/models/User.js
module.exports = {
attributes: {
name: 'string',
roles: {
collection: 'role',
via: 'users'
}
}
};
// api/models/Role.js
module.exports = {
attributes: {
users: {
collection: 'user',
via: 'roles'
},
name: {
type: 'string',
required: true
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment