Skip to content

Instantly share code, notes, and snippets.

@cray0000
Created November 20, 2013 05:45
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cray0000/7558334 to your computer and use it in GitHub Desktop.
Save cray0000/7558334 to your computer and use it in GitHub Desktop.
ALLOWED_COLLECTIONS = [
'auths' # Private user data
]
store.allow 'create', 'auths', (docId, newDoc, session) ->
console.log '[Auths] CREATE'
undefined
store.allow 'all', 'auths.*', (docId, relPath, opData, docBeingUpdated, session) ->
console.log '[Auths] CHANGE'
return undefined if session.userId in store.ADMINS
if docBeingUpdated and docId isnt session.userId
'Unauthorized auth change'
else
undefined
store.allow 'del', 'auths', (docId, docToRemove, session) ->
console.log '[Auths] DELETE'
'Unauthorized auth delete'
store.allow 'all', '**', (docId, relPath, opData, docBeingUpdated, connectSession) ->
'Unauthorized action' unless opData.collection in ALLOWED_COLLECTIONS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment