Files
habitica/lib/server/setupStore.js
Tyler Renelle c9226b34bd Revert "temporarily disable accessControl so i can run schema update"
This reverts commit 01159545d8492831f4048235c2ab633a7d2d4905.
2012-09-04 23:08:11 -04:00

31 lines
862 B
JavaScript

// Generated by CoffeeScript 1.3.3
module.exports.queries = function(store) {
return store.query.expose('users', 'withId', function(id) {
return this.byId(id);
});
};
module.exports.accessControl = function(store) {
store.accessControl = true;
store.readPathAccess('users.*', function() {
var captures, next;
if (!(this.session && this.session.userId)) {
return;
}
captures = arguments[0];
next = arguments[arguments.length - 1];
return next(captures === this.session.userId);
});
return store.writeAccess('*', 'users.*', function() {
var captures, next, pathArray;
if (!(this.session && this.session.userId)) {
return;
}
captures = arguments[0];
next = arguments[arguments.length - 1];
pathArray = captures.split('.');
return next(pathArray[0] === this.session.userId);
});
};