Created
November 20, 2013 05:45
-
-
Save cray0000/7558334 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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