From f9849454e9d63c560f0920874a8bb914b3bc3994 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Mon, 28 Oct 2013 10:44:05 -0700 Subject: [PATCH] Update ACL model --- lib/models/acl.js | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/models/acl.js b/lib/models/acl.js index c304e362..c91ffdcf 100644 --- a/lib/models/acl.js +++ b/lib/models/acl.js @@ -31,16 +31,44 @@ Map to oAuth 2.0 scopes */ +/* +var ACLEntrySchema = { + principal: String, // Application/User/Role + action: String, // READ/WRITE or method name + allowed: Boolean // Positive or negative +} + +var ACLSchema = { + publicReadAccess: Boolean, + publicWriteAccess: Boolean, + permissions: [ACLEntrySchema], + created: Date, + modified: Date +} + + +var AccessLevel = [ + NotAllowed: 'Not Allowed', // Disabled + // 'Allowed when Logged-in', + Owner: 'Allow to Object Owner', + Role: 'Users defined in a Role', + Related: 'Any User with a relationship to the object', + Authenticated: 'Allow to Any Logged In User', + 'Open' +]; +*/ + var ACLSchema = { model: String, // The model name properties: [String], // A list of property names methods: [String], // A list of methods + users: [String], // A list of users roles: [String], // A list of roles permission: {type: String, enum: ['Allow', 'Deny']}, // Allow/Deny status: String, // Enabled/disabled created: Date, modified: Date -} +}; // readAccess, writeAccess --> public, userId, role @@ -48,4 +76,4 @@ module.exports = function(dataSource) { dataSource = dataSource || new require('loopback-datasource-juggler').ModelBuilder(); var ACL = dataSource.define('ACL', ACLSchema); return ACL; -} \ No newline at end of file +}; \ No newline at end of file