mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-20 10:44:13 +00:00
add server-only write paths
This commit is contained in:
parent
27fc924b30
commit
590fa1669c
2 changed files with 18 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ derby.use(require 'racer-db-mongo')
|
|||
store = derby.createStore
|
||||
db: {type: 'Mongo', uri: process.env.NODE_DB_URI, safe:true}
|
||||
listen: server
|
||||
require('./store')(store) #setup custom accessControl
|
||||
|
||||
ONE_YEAR = 1000 * 60 * 60 * 24 * 365
|
||||
root = path.dirname path.dirname __dirname
|
||||
|
|
|
|||
17
src/server/store.coffee
Normal file
17
src/server/store.coffee
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
###
|
||||
Setup read / write access
|
||||
@param store
|
||||
###
|
||||
module.exports = (store) ->
|
||||
|
||||
store.writeAccess "*", "users.*.balance", -> # captures, value, next ->
|
||||
return unless @session and @session.userId # https://github.com/codeparty/racer/issues/37
|
||||
next = arguments[arguments.length - 1]
|
||||
isServer = not @req.socket
|
||||
next(isServer)
|
||||
|
||||
store.writeAccess "*", "users.*.flags.ads", -> # captures, value, next ->
|
||||
return unless @session and @session.userId # https://github.com/codeparty/racer/issues/37
|
||||
next = arguments[arguments.length - 1]
|
||||
isServer = not @req.socket
|
||||
next(isServer)
|
||||
Loading…
Reference in a new issue