loopback/lib/models/role.js

25 lines
745 B
JavaScript
Raw Normal View History

2013-11-04 21:19:02 +00:00
var loopback = require('loopback');
// Role model
var RoleSchema = {
2013-11-04 21:19:02 +00:00
id: {type: String, id: true}, // Id
2013-07-08 23:59:11 +00:00
name: {type: String, required: true}, // The name of a role
2013-07-09 22:06:42 +00:00
description: String, // Description
roles: [String], // A role can be an aggregate of other roles
2013-07-09 22:06:42 +00:00
users: [String], // A role contains a list of user ids
// Timestamps
created: {type: Date, default: Date},
modified: {type: Date, default: Date}
2013-11-04 21:19:02 +00:00
};
var Role = loopback.createModel('Role', RoleSchema);
module.exports = Role;
Role.OWNER ='$owner'; // owner of the object
Role.RELATED = "$related"; // any User with a relationship to the object
Role.AUTHENTICATED = "$authenticated"; // authenticated user
Role.EVERYONE = "$everyone"; // everyone
2013-07-09 22:06:42 +00:00