From e2023399aa4f189b51455b8a1d765f368fcfe089 Mon Sep 17 00:00:00 2001 From: Nick Martin Date: Sat, 6 Oct 2012 22:28:23 -0700 Subject: [PATCH] First pass: a place for everything and everything in its place. We really need to make this easier. --- docs/client/api.html | 62 +++++++ docs/client/api.js | 427 +++++++++++++++++++++++++++++++++++++++++++ docs/client/docs.js | 42 ++++- 3 files changed, 529 insertions(+), 2 deletions(-) diff --git a/docs/client/api.html b/docs/client/api.html index 3accf566b9..385515606b 100644 --- a/docs/client/api.html +++ b/docs/client/api.html @@ -120,6 +120,8 @@ is the place to stop the observes. {{> api_box subscription_stop}} +{{> api_box subscription_userId}} + {{> api_box subscribe}} When you subscribe to a record set, it tells the server to send records @@ -215,6 +217,10 @@ intended to *simulate* the result of what the server's method will do, but without waiting for the round trip delay. If a stub throws an exception it will be logged to the console. +{{> api_box method_invocation_userId}} + +{{> api_box method_invocation_setUserId}} + {{> api_box method_invocation_isSimulation}} {{> api_box method_invocation_unblock}} @@ -623,6 +629,27 @@ Example: Logs.remove({}); +{{> api_box allow}} + +
+{{#dtdd "insert(userId, doc)"}} +blah blah +{{/dtdd}} + +{{#dtdd "update(userId, docs, fields, modifier)"}} +blah +{{/dtdd}} + +{{#dtdd "remove(userId, docs)"}} +blah +{{/dtdd}} + +
+ + +{{> api_box deny}} + +

Cursors

To create a cursor, use [`find`](#find). To access the documents in a @@ -1460,6 +1487,41 @@ sub-template. +

Accounts

+ +{{> api_box user}} + +{{> api_box userId}} + +{{> api_box users}} + +XXX schema? + +{{> api_box logout}} +{{> api_box loginWithPassword}} +{{> api_box loginWithFacebook}} +{{> api_box loginWithGithub}} +{{> api_box loginWithGoogle}} +{{> api_box loginWithTwitter}} +{{> api_box loginWithWeibo}} + +{{> api_box accounts_createUser}} +{{> api_box accounts_changePassword}} +{{> api_box accounts_forgotPassword}} +{{> api_box accounts_resetPassword}} +{{> api_box accounts_validateEmail}} + +{{> api_box accounts_config}} +{{> api_box accounts_emailTemplates}} +{{> api_box accounts_validateNewUser}} +{{> api_box accounts_onCreateUser}} +{{> api_box accounts_setPassword}} +{{> api_box accounts_configuration}} + +{{> api_box accounts_facebook_config}} +{{> api_box accounts_google_config}} + +

Timers

Meteor uses global environment variables diff --git a/docs/client/api.js b/docs/client/api.js index aa0a1aa3ed..a9314df0f4 100644 --- a/docs/client/api.js +++ b/docs/client/api.js @@ -145,6 +145,14 @@ Template.api.subscription_onStop = { ] }; +Template.api.subscription_userId = { + id: "publish_userId", + name: "this.userId()", + locus: "Server", + descr: ["Returns the id of current user, or `null` if no user logged in. The publish function is rerun when this changes."] +}; + + Template.api.subscribe = { id: "meteor_subscribe", name: "Meteor.subscribe(name [, arg1, arg2, ... ] [, onComplete])", @@ -187,6 +195,25 @@ Template.api.methods = { ] }; +Template.api.method_invocation_userId = { + id: "method_userId", + name: "this.userId()", + locus: "Anywhere", + descr: ["Returns the id of current user, or `null` if no user logged in. XXX Will remain constant."] +}; + +Template.api.method_invocation_setUserId = { + id: "method_setUserId", + name: "this.setUserId(userId)", + locus: "Server", + descr: ["Set the userId for this session. This affects all future method calls. Pass `null` to log the user out."], + args: [ + {name: "userId", + type: "String", + descr: "XXX"} + ] +}; + Template.api.method_invocation_unblock = { id: "method_unblock", name: "this.unblock()", @@ -427,6 +454,31 @@ Template.api.remove = { ] }; +Template.api.allow = { + id: "allow", + name: "collection.allow(options)", + locus: "Server", + descr: ["Control access to XXX"], + options: [ + {name: "insert", + type: "Function", + descr: "XXX"} + ] +}; + +Template.api.deny = { + id: "deny", + name: "collection.deny(options)", + locus: "Server", + descr: ["Control access to XXX"], + options: [ + {name: "insert", + type: "Function", + descr: "XXX"} + ] +}; + + Template.api.cursor_count = { id: "count", name: "cursor.count()", @@ -610,6 +662,381 @@ Template.api.isolate = { +Template.api.user = { + id: "meteor_user", + name: "Meteor.user()", + locus: "XXX client+methods", + descr: ["Returns the current user object, of null if not logged in. A reactive data source."] +}; + +Template.api.userId = { + id: "meteor_userid", + name: "Meteor.userId()", + locus: "XXX client+methods", + descr: ["Returns the current user id, of null if not logged in. A reactive data source."] +}; + + +Template.api.users = { + id: "meteor_users", + name: "Meteor.users", + locus: "Anywhere", + descr: ["A XXXlinkify Collection holding user documents."] +}; + + +Template.api.logout = { + id: "meteor_logout", + name: "Meteor.logout([callback])", + locus: "Client", + descr: ["Log the user out."], + args: [ + { + name: "callback", + type: "Function", + descr: "XXX" + } + ] +}; + + +Template.api.loginWithPassword = { + id: "meteor_loginwithpassword", + name: "Meteor.loginWithPassword(user, password, [callback])", + locus: "Client", + descr: ["Log the user in."], + args: [ + { + name: "user", + type: "Object or String", + descr: "XXX" + }, + { + name: "password", + type: "String", + descr: "XXX" + }, + { + name: "callback", + type: "Function", + descr: "XXX" + } + ] +}; + + +Template.api.loginWithFacebook = { + id: "meteor_loginwithfacebook", + name: "Meteor.loginWithFacebook([callback])", + locus: "Client", + descr: ["Log the user in."], + args: [ + { + name: "callback", + type: "Function", + descr: "XXX" + } + ] +}; + +Template.api.loginWithGithub = { + id: "meteor_loginwithgithub", + name: "Meteor.loginWithGithub([callback])", + locus: "Client", + descr: ["Log the user in."], + args: [ + { + name: "callback", + type: "Function", + descr: "XXX" + } + ] +}; + +Template.api.loginWithGoogle = { + id: "meteor_loginwithgoogle", + name: "Meteor.loginWithGoogle([callback])", + locus: "Client", + descr: ["Log the user in."], + args: [ + { + name: "callback", + type: "Function", + descr: "XXX" + } + ] +}; + +Template.api.loginWithTwitter = { + id: "meteor_loginwithtwitter", + name: "Meteor.loginWithTwitter([callback])", + locus: "Client", + descr: ["Log the user in."], + args: [ + { + name: "callback", + type: "Function", + descr: "XXX" + } + ] +}; + +Template.api.loginWithWeibo = { + id: "meteor_loginwithweibo", + name: "Meteor.loginWithWeibo([callback])", + locus: "Client", + descr: ["Log the user in."], + args: [ + { + name: "callback", + type: "Function", + descr: "XXX" + } + ] +}; + + +Template.api.accounts_createUser = { + id: "accounts_createuser", + name: "Accounts.createUser(options, extra, [callback])", + locus: "Anywhere", + descr: ["Create a new user."], + args: [ + { + name: "options", + type: "Object", + descr: "XXX" + }, + { + name: "extra", + type: "Object", + descr: "XXX" + }, + { + name: "callback", + type: "Function", + descr: "XXX" + } + ], + options: [ + { + name: "username", + type: "String", + descr: "XXX" + }, + { + name: "email", + type: "String", + descr: "XXX" + }, + { + name: "password", + type: "String", + descr: "XXX" + } + ] +}; + +Template.api.accounts_changePassword = { + id: "accounts_changepassword", + name: "Accounts.changePassword(oldPassword, newPassword, [callback])", + locus: "Client", + descr: ["Change the users password. Must be logged in."], + args: [ + { + name: "oldPassword", + type: "String", + descr: "XXX" + }, + { + name: "newPassword", + type: "String", + descr: "XXX" + }, + { + name: "callback", + type: "Function", + descr: "XXX" + } + ] +}; + +Template.api.accounts_forgotPassword = { + id: "accounts_forgotpassword", + name: "Accounts.forgotPassword(options, [callback])", + locus: "Client", + descr: ["Request a forgot password email"], + args: [ + { + name: "callback", + type: "Function", + descr: "XXX" + } + ], + options: [ + { + name: "email", + type: "String", + descr: "The email address to send a password reminder to." + } + ] +}; + +Template.api.accounts_resetPassword = { + id: "accounts_resetpassword", + name: "Accounts.resetPassword(token, newPassword, [callback])", + locus: "Client", + descr: ["Reset the password for a user, using the token from email. Logs you in afterwards."], + args: [ + { + name: "token", + type: "String", + descr: "XXX" + }, + { + name: "newPassword", + type: "String", + descr: "XXX" + }, + { + name: "callback", + type: "Function", + descr: "XXX" + } + ], + options: [ + { + name: "email", + type: "String", + descr: "The email address to send a password reminder to." + } + ] +}; + +Template.api.accounts_validateEmail = { + id: "accounts_validateemail", + name: "Accounts.validateEmail(token, [callback])", + locus: "Client", + descr: ["Marks the user's email address as validated. Logs the user in afterwards."], + args: [ + { + name: "token", + type: "String", + descr: "XXX" + }, + { + name: "callback", + type: "Function", + descr: "XXX" + } + ] +}; + + + + +Template.api.accounts_config = { + id: "accounts_config", + name: "Accounts.config(options)", + locus: "Anywhere", + descr: ["Set global accounts options."], + options: [ + { + name: "validateEmail", + type: "Boolean", + descr: "If true, new users with an email address will receive a verifcation email." + }, + { + name: "forbidSignups", + type: "Boolean", + descr: "If true, new user signups will be rejected. Server-side user creation via XXXlinkify createUser is still allowed." + } + ] +}; + +Template.api.accounts_emailTemplates = { + id: "accounts_emailtemplates", + name: "Accounts.emailTemplates", + locus: "Anywhere", + descr: ["XXX"] +}; + + +Template.api.accounts_validateNewUser = { + id: "accounts_validatenewuser", + name: "Accounts.validateNewUser(func)", + locus: "Server", + descr: ["Set up a new user validator."], + args: [ + { + name: "func", + type: "Function", + descr: "Validator function. Takes a new user object, and returns true to allow the creation or false to abort." + } + ] +}; + +Template.api.accounts_onCreateUser = { + id: "accounts_oncreateuser", + name: "Accounts.onCreateUser(func)", + locus: "Server", + descr: ["Set up a new user mangler XXX."], + args: [ + { + name: "func", + type: "Function", + descr: "Validator function. Takes `(options, extra, user)`. Return the new user, or throw an `Error`." + } + ] +}; + + +Template.api.accounts_setPassword = { + id: "accounts_setpassword", + name: "Accounts.setPassword(userId, newPassword)", + locus: "Server", + descr: ["Force change the password for a user."], + args: [ + { + name: "userId", + type: "String", + descr: "XXX" + }, + { + name: "newPassword", + type: "String", + descr: "XXX" + } + ] +}; + +Template.api.accounts_configuration = { + id: "accounts_configuration", + name: "Accounts.configuration", + locus: "Anywhere", + descr: ["A XXXlinkify Collection holding login service info."] +}; + + +Template.api.accounts_facebook_config = { + id: "accounts_facebook_config", + name: "Accounts.facebook.config(options)", + locus: "Anywhere", + descr: ["XXX REMOVE!"] +}; + +Template.api.accounts_google_config = { + id: "accounts_google_config", + name: "Accounts.google.config(options)", + locus: "Anywhere", + descr: ["XXX REMOVE!"] +}; + + + + + + Template.api.setTimeout = { id: "meteor_settimeout", name: "Meteor.setTimeout", diff --git a/docs/client/docs.js b/docs/client/docs.js index bd90697b0c..bc0b08b6b6 100644 --- a/docs/client/docs.js +++ b/docs/client/docs.js @@ -93,7 +93,8 @@ var toc = [ {instance: "this", name: "complete", id: "publish_complete"}, {instance: "this", name: "flush", id: "publish_flush"}, {instance: "this", name: "onStop", id: "publish_onstop"}, - {instance: "this", name: "stop", id: "publish_stop"} + {instance: "this", name: "stop", id: "publish_stop"}, + {instance: "this", name: "userId", id: "publish_userId"} ], "Meteor.subscribe", "Meteor.autosubscribe" @@ -101,6 +102,8 @@ var toc = [ {name: "Methods", id: "methods_header"}, [ "Meteor.methods", [ + {instance: "this", name: "userId", id: "method_userId"}, + {instance: "this", name: "setUserId", id: "method_setUserId"}, {instance: "this", name: "isSimulation", id: "method_issimulation"}, {instance: "this", name: "unblock", id: "method_unblock"} ], @@ -121,7 +124,9 @@ var toc = [ {instance: "collection", name: "findOne"}, {instance: "collection", name: "insert"}, {instance: "collection", name: "update"}, - {instance: "collection", name: "remove"} + {instance: "collection", name: "remove"}, + {instance: "collection", name: "allow"}, + {instance: "collection", name: "deny"} ], "Meteor.Collection.Cursor", [ @@ -168,6 +173,39 @@ var toc = [ {name: "Reactivity isolation", style: "noncode", id: "isolate"} ], + {name: "Accounts", id: "accounts_api"}, [ + "Meteor.user", + "Meteor.userId", + "Meteor.users", + "Meteor.logout", + "Meteor.loginWithPassword", + "Meteor.loginWithFacebook", + "Meteor.loginWithGithub", + "Meteor.loginWithGoogle", + "Meteor.loginWithTwitter", + "Meteor.loginWithWeibo", + {type: "spacer"}, + + "Accounts.createUser", + "Accounts.changePassword", + "Accounts.forgotPassword", + "Accounts.resetPassword", + "Accounts.validateEmail", + {type: "spacer"}, + + "Accounts.config", + "Accounts.emailTemplates", + "Accounts.validateNewUser", + "Accounts.onCreateUser", + "Accounts.setPassword", + "Accounts.configuration", + {type: "spacer"}, + + "Accounts.facebook.config", + "Accounts.google.config" + ], + + "Timers", [ "Meteor.setTimeout", "Meteor.setInterval",