Skip to content

Commit

Permalink
Merged pull request #75 from eirikb/master.
Browse files Browse the repository at this point in the history
Persistent server-side object for storing data server side (partial implementation)
  • Loading branch information
sridatta committed Apr 29, 2011
2 parents b7075c5 + 46acff6 commit c32f773
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/nowServerLib.js
Expand Up @@ -60,7 +60,8 @@ var nowCore = {


// Create proxy object
nowCore.proxies[client.sessionId] = proxy.wrap(nowCore.constructClientScopeStore(client), scope, client.sessionId);
client.user = client.user ? client.user : {clientId: client.sessionId};
nowCore.proxies[client.sessionId] = proxy.wrap(nowCore.constructClientScopeStore(client), scope, client.user);
nowCore.scopes[client.sessionId] = scope;
nowCore.clientGroups[client.sessionId] = [];

Expand Down
6 changes: 3 additions & 3 deletions lib/wrap.js
@@ -1,6 +1,6 @@
var Proxy = require('node-proxy');

exports.wrap = function (store, sessions, clientId) {
exports.wrap = function (store, sessions, user) {
var taint = {};
var taintedFqns = {};
var set = store ? (store.set || store.save).bind(store) : null;
Expand All @@ -13,8 +13,8 @@ exports.wrap = function (store, sessions, clientId) {
else {
var returnObj = wrapRoot(name, sessions[name], '["'+name+'"]', theProxy);
if(typeof returnObj === 'function' && sessions.hasOwnProperty(name)){
if(clientId){
returnObj = returnObj.bind({now: theProxy, user:{clientId: clientId}});
if(user){
returnObj = returnObj.bind({now: theProxy, user:user});
} else {
returnObj = returnObj.bind({now: theProxy});
}
Expand Down

0 comments on commit c32f773

Please sign in to comment.