Add Role.findByName and more comments
This commit is contained in:
parent
af2b8dd4ff
commit
a72a42e436
|
@ -96,15 +96,15 @@ var ACL = loopback.createModel('ACL', ACLSchema);
|
|||
|
||||
ACL.ALL = '*';
|
||||
|
||||
ACL.DEFAULT = 'DEFAULT';
|
||||
ACL.ALLOW = 'ALLOW';
|
||||
ACL.ALARM = 'ALARM';
|
||||
ACL.AUDIT = 'AUDIT';
|
||||
ACL.DENY = 'DENY';
|
||||
ACL.DEFAULT = 'DEFAULT'; // Not specified
|
||||
ACL.ALLOW = 'ALLOW'; // Allow
|
||||
ACL.ALARM = 'ALARM'; // Warn - send an alarm
|
||||
ACL.AUDIT = 'AUDIT'; // Audit - record the access
|
||||
ACL.DENY = 'DENY'; // Deny
|
||||
|
||||
ACL.READ = 'READ';
|
||||
ACL.WRITE = 'WRITE';
|
||||
ACL.EXECUTE = 'EXECUTE';
|
||||
ACL.READ = 'READ'; // Read operation
|
||||
ACL.WRITE = 'WRITE'; // Write operation
|
||||
ACL.EXECUTE = 'EXECUTE'; // Execute operation
|
||||
|
||||
ACL.USER = 'USER';
|
||||
ACL.APP = ACL.APPLICATION = 'APP';
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
var loopback = require('../loopback');
|
||||
var assert = require('assert');
|
||||
|
||||
// Role model
|
||||
var RoleSchema = {
|
||||
|
@ -91,6 +92,11 @@ var Role = loopback.createModel('Role', RoleSchema, {
|
|||
}
|
||||
});
|
||||
|
||||
Role.findByName = function(name, callback) {
|
||||
assert(name, 'Name is required');
|
||||
Role.findOne({where: {name: name}}, callback);
|
||||
};
|
||||
|
||||
// Set up the connection to users/applications/roles once the model
|
||||
Role.once('dataSourceAttached', function () {
|
||||
Role.prototype.users = function (callback) {
|
||||
|
|
Loading…
Reference in New Issue