From 8ec0533eb441c81b65666bed183d58cea06f6c8e Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Wed, 26 Jun 2013 16:25:51 -0700 Subject: [PATCH] Add schema skeletons for built-in models --- lib/models/acl.js | 17 ++++++++++++++++ lib/models/application.js | 41 ++++++++++++++++++++++++++++++++++++++ lib/models/installation.js | 4 ++++ lib/models/role.js | 11 ++++++++++ lib/models/user.js | 11 ++++++++++ 5 files changed, 84 insertions(+) create mode 100644 lib/models/acl.js create mode 100644 lib/models/application.js create mode 100644 lib/models/installation.js create mode 100644 lib/models/role.js create mode 100644 lib/models/user.js diff --git a/lib/models/acl.js b/lib/models/acl.js new file mode 100644 index 00000000..d10f2c3c --- /dev/null +++ b/lib/models/acl.js @@ -0,0 +1,17 @@ +// Schema ACL options + + +// Object level permissions + +// open: no protection +// none: always rejected +// owner: only the owner +// loggedIn: any logged in user +// roles: logged in users with the roles +// related: owner of the related objects + +// Class level permissions + +// scopes + +// URL level permissions \ No newline at end of file diff --git a/lib/models/application.js b/lib/models/application.js new file mode 100644 index 00000000..173d2b97 --- /dev/null +++ b/lib/models/application.js @@ -0,0 +1,41 @@ +// Application model +var ApplicationSchema = { + + // Basic information + id: {type: String, required: true}, + name: {type: String, required: true}, + description: String, // description + icon: String, // The icon url + public: Boolean, + permissions: [String], + + userId: String, + + status: String, + + // Keys + clientKey: String, + javaScriptKey: String, + restApiKey: String, + windowsKey: String, + masterKey: String, + + // Push notification + pushPlatforms: [String], + pushCredentials: [], + + // Authentication + authenticationEnabled: Boolean, + anonymousAllowed: Boolean, + schemes: [String], // Basic, facebook, github, google + attachedCredentials: [], + + // email + email: String, // e-mail address + emailVerified: Boolean, // Is the e-mail verified + + collaborators: [String], // A list of users ids who have permissions to work on this app + + created: Date, + lastUpdated: Date +}; diff --git a/lib/models/installation.js b/lib/models/installation.js new file mode 100644 index 00000000..37e8bd0d --- /dev/null +++ b/lib/models/installation.js @@ -0,0 +1,4 @@ +// Device registration +var InstallationSchema = { + +}; diff --git a/lib/models/role.js b/lib/models/role.js new file mode 100644 index 00000000..a9546777 --- /dev/null +++ b/lib/models/role.js @@ -0,0 +1,11 @@ +// Role model +var RoleSchema = { + id: {type: String, required: true}, + name: {type: String, required: true}, + roles: [String], + users: [String], + acl: [], + + created: Date, + lastUpdated: Date +} \ No newline at end of file diff --git a/lib/models/user.js b/lib/models/user.js new file mode 100644 index 00000000..38d20452 --- /dev/null +++ b/lib/models/user.js @@ -0,0 +1,11 @@ +// User model +var UserSchema = { + id: {type: String, required: true}, + username: {type: String, required: true}, + password: String, + authData: [], + email: String, + emailVerified: Boolean, + created: Date, + lastUpdated: Date +} \ No newline at end of file