jeudi 19 février 2015

how to show 403 error in Meteor.js app?


Vote count:

0




I'm trying to notify user that the document is exist but user have no rights to see it.


throwing Meteor.Error from publish function does not work.



Meteor.publish "projectWithStories", (projectId) ->
check projectId, String

project = Projects.findOne projectId

# return nothing if there is no project with this id
unless project then @ready

# check if the user has rights
if documentAuthorOrAddedUser @userId, project
[
project
Stories.find projectId: projectId
]
else
@ready()
# this does not work =//
# without this i'm getting 'dataNotFound' that is not valid
throw new Meteor.Error 403, "Not allowed"


also i'm using iron router and 'dataNotFound' hook



asked 44 secs ago







how to show 403 error in Meteor.js app?

Aucun commentaire:

Enregistrer un commentaire