From 2afe5f9b2b59094b632e79e0a0fec0cd70509273 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Wed, 1 Aug 2012 13:37:00 +0000 Subject: [PATCH] API: add OC_API::checkLoggedIn() --- lib/api.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/api.php b/lib/api.php index cf699f547f..a11dde1c6b 100644 --- a/lib/api.php +++ b/lib/api.php @@ -121,4 +121,15 @@ class OC_API { } } + /** + * check if the user is authenticated + */ + public static function checkLoggedIn(){ + // Check OAuth + if(!OC_OAuth::isAuthorised()){ + OC_Response::setStatus(401); + die(); + } + } + }