2013-11-04 21:19:02 +00:00
|
|
|
var loopback = require('loopback');
|
|
|
|
|
2013-06-26 23:25:51 +00:00
|
|
|
// 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
|
2013-07-01 18:51:28 +00:00
|
|
|
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
|
|
|
|