From 609a8894ece85ab36dc5ef88db5f290484dce9ff Mon Sep 17 00:00:00 2001 From: mayjs Date: Mon, 15 May 2017 18:40:45 +0200 Subject: Added a non restrictive authentication function --- server/authentication.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/authentication.js b/server/authentication.js index 816c4d4c..6fee8649 100644 --- a/server/authentication.js +++ b/server/authentication.js @@ -17,5 +17,15 @@ Meteor.startup(() => { }; + // This will only check if the user is logged in. + // The authorization checks for the user will have to be done inside each API endpoint + Authentication.checkLoggedIn = function(userId) { + if(userId === undefined) { + const error = new Meteor.Error('Unauthorized', 'Unauthorized'); + error.statusCode = 401; + throw error; + } + }; + }); -- cgit v1.2.3-1-g7c22