From b1c17b1a457528bbc32cf9a517726fca7add6ac7 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 17 Oct 2016 17:43:12 -0400 Subject: [PATCH] Fix messages API to not NPE show_if does not work on a method route --- endpoints/api/globalmessages.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/endpoints/api/globalmessages.py b/endpoints/api/globalmessages.py index c7e60e8f7..6874a8d2c 100644 --- a/endpoints/api/globalmessages.py +++ b/endpoints/api/globalmessages.py @@ -71,9 +71,11 @@ class GlobalUserMessages(ApiResource): @nickname('createGlobalMessage') @validate_json_request('CreateMessage') @require_scope(scopes.SUPERUSER) - @show_if(features.SUPER_USERS) def post(self): """ Create a message """ + if not features.SUPER_USERS: + abort(404) + if SuperUserPermission().can(): model.message.create([request.get_json()['message']]) return make_response('', 201)