don't need public/private paths after all, can check path requests in store accessControl callbacks

This commit is contained in:
Tyler Renelle
2013-02-04 22:35:07 -05:00
parent 6966f6a439
commit 9723f3c37a
10 changed files with 186 additions and 188 deletions
+2 -2
View File
@@ -31,8 +31,8 @@ module.exports.deleteStaleAccounts = ->
collection.findEach un_registered, (err, user) ->
throw err if err
return unless user? #why does this happen sometimes?
if !!user.priv.lastCron # for now ignore missing crons, still looking into why this is happening
lastCron = new Date(user.priv.lastCron)
if !!user.lastCron # for now ignore missing crons, still looking into why this is happening
lastCron = new Date(user.lastCron)
diff = Math.abs(moment(today).sod().diff(moment(lastCron).sod(), "days"))
if diff > 10
removeAccount(collection, user._id)
+4 -4
View File
@@ -35,8 +35,8 @@ module.exports.app = (appExports, model) ->
appExports.buyReroll = (e, el, next) ->
batch = new schema.BatchUpdate(model)
obj = model.get('_user')
batch.set 'priv.balance', obj.priv.balance-1
_.each obj.priv.tasks, (task) -> batch.set("priv.tasks.#{task.id}.value", 0) unless task.type == 'reward'
batch.set 'balance', obj.balance-1
_.each obj.tasks, (task) -> batch.set("tasks.#{task.id}.value", 0) unless task.type == 'reward'
batch.commit()
module.exports.routes = (expressApp) ->
@@ -53,8 +53,8 @@ module.exports.routes = (expressApp) ->
userId = model.session.userId
model.fetch "users.#{userId}", (err, user) ->
model.ref '_user', "users.#{userId}"
model.set('_user.priv.balance', model.get('_user.priv.balance')+5)
model.set('_user.priv.flags.ads','hide')
model.set('_user.balance', model.get('_user.balance')+5)
model.set('_user.flags.ads','hide')
return res.send(200)
api_key = process.env.STRIPE_API_KEY # secret stripe API key
+2 -2
View File
@@ -49,8 +49,8 @@ module.exports = (expressApp, root, derby) ->
# Create task if doesn't exist
# TODO add service & icon to task
unless model.get("_user.priv.tasks.#{taskId}")
model.refList "_habitList", "_user.priv.tasks", "_user.priv.idLists.habit"
unless model.get("_user.tasks.#{taskId}")
model.refList "_habitList", "_user.tasks", "_user.idLists.habit"
model.at('_habitList').push {
id: taskId
type: 'habit'