Update ACL model
This commit is contained in:
parent
51a38fc0f6
commit
f9849454e9
|
@ -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 = {
|
var ACLSchema = {
|
||||||
model: String, // The model name
|
model: String, // The model name
|
||||||
properties: [String], // A list of property names
|
properties: [String], // A list of property names
|
||||||
methods: [String], // A list of methods
|
methods: [String], // A list of methods
|
||||||
|
users: [String], // A list of users
|
||||||
roles: [String], // A list of roles
|
roles: [String], // A list of roles
|
||||||
permission: {type: String, enum: ['Allow', 'Deny']}, // Allow/Deny
|
permission: {type: String, enum: ['Allow', 'Deny']}, // Allow/Deny
|
||||||
status: String, // Enabled/disabled
|
status: String, // Enabled/disabled
|
||||||
created: Date,
|
created: Date,
|
||||||
modified: Date
|
modified: Date
|
||||||
}
|
};
|
||||||
|
|
||||||
// readAccess, writeAccess --> public, userId, role
|
// readAccess, writeAccess --> public, userId, role
|
||||||
|
|
||||||
|
@ -48,4 +76,4 @@ module.exports = function(dataSource) {
|
||||||
dataSource = dataSource || new require('loopback-datasource-juggler').ModelBuilder();
|
dataSource = dataSource || new require('loopback-datasource-juggler').ModelBuilder();
|
||||||
var ACL = dataSource.define('ACL', ACLSchema);
|
var ACL = dataSource.define('ACL', ACLSchema);
|
||||||
return ACL;
|
return ACL;
|
||||||
}
|
};
|
Loading…
Reference in New Issue