Created
June 29, 2015 16:17
-
-
Save ebourmalo/d3c5f776c8894a343f48 to your computer and use it in GitHub Desktop.
This file contains 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
// Handle specific permissions | |
app.service(resourcePath) | |
.before({ | |
update: handleUpdatePermissions | |
}); | |
/** | |
* Handle permissions when updating a project | |
* | |
* @param hook {Object} - | |
* @param next {Function} - | |
*/ | |
function handleUpdatePermissions (hook, next) { | |
var user = hook.params.user; | |
var projectId = hook.id; | |
return next(new Error('Just for test')); | |
/* propagate and crash the server with an error 500 response | |
for the client. How to handle that knowing I don't have access | |
to the generated rest route for the update (PUT) */ | |
} |
Well, we sort of support this with feathers-associations
but after starting down that road we realized that you don't even actually need routes like that. You could just call /api/users/2
. No need to complicate it by adding more params to your route.
Think about it, when you are calling /api/groups/123/users/2
you already have the user ID. This has come up quite a few times so we are going to be addressing it much more clearly in the documentation in the next release.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I currently work on having these features if it's not available at the moment (I may be wrong..). I'll push a PR if you guys are interested :)