From: Frank Karlitschek Date: Tue, 1 May 2012 20:59:38 +0000 (+0200) Subject: ported checkLoggedIn and checkAdmin X-Git-Tag: v4.0.0beta~115 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=31e32e3c10ace169e0d841ff6e4b17d11fe64f1b;p=nextcloud-server.git ported checkLoggedIn and checkAdmin --- diff --git a/apps/admin_migrate/settings.php b/apps/admin_migrate/settings.php old mode 100644 new mode 100755 index 94bf6052a6b..da96e1a8684 --- a/apps/admin_migrate/settings.php +++ b/apps/admin_migrate/settings.php @@ -22,7 +22,7 @@ * License along with this library. If not, see . * */ -OC_Util::checkAdminUser(); +OCP\User::checkAdminUser(); OC_Util::checkAppEnabled('admin_migrate'); // Export? diff --git a/apps/bookmarks/addBm.php b/apps/bookmarks/addBm.php old mode 100644 new mode 100755 index 27e01bb3baf..afe61875737 --- a/apps/bookmarks/addBm.php +++ b/apps/bookmarks/addBm.php @@ -24,7 +24,7 @@ // Check if we are a user -OC_Util::checkLoggedIn(); +OCP\User::checkLoggedIn(); OC_Util::checkAppEnabled('bookmarks'); require_once('bookmarksHelper.php'); diff --git a/apps/bookmarks/index.php b/apps/bookmarks/index.php index 575c14c114c..7ab74c5f3f3 100755 --- a/apps/bookmarks/index.php +++ b/apps/bookmarks/index.php @@ -24,7 +24,7 @@ // Check if we are a user -OC_Util::checkLoggedIn(); +OCP\User::checkLoggedIn(); OC_Util::checkAppEnabled('bookmarks'); OC_App::setActiveNavigationEntry( 'bookmarks_index' ); diff --git a/apps/calendar/export.php b/apps/calendar/export.php old mode 100644 new mode 100755 index 0972ee0f788..9b71bc6910f --- a/apps/calendar/export.php +++ b/apps/calendar/export.php @@ -7,7 +7,7 @@ */ -OC_Util::checkLoggedIn(); +OCP\User::checkLoggedIn(); OC_Util::checkAppEnabled('calendar'); $cal = isset($_GET['calid']) ? $_GET['calid'] : NULL; $event = isset($_GET['eventid']) ? $_GET['eventid'] : NULL; diff --git a/apps/calendar/index.php b/apps/calendar/index.php index cc6b19a0402..77550420b53 100755 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -7,7 +7,7 @@ */ -OC_Util::checkLoggedIn(); +OCP\User::checkLoggedIn(); OC_Util::checkAppEnabled('calendar'); // Create default calendar ... diff --git a/apps/contacts/export.php b/apps/contacts/export.php old mode 100644 new mode 100755 index 95d02a9afd4..84bf26042fb --- a/apps/contacts/export.php +++ b/apps/contacts/export.php @@ -7,7 +7,7 @@ */ -OC_Util::checkLoggedIn(); +OCP\User::checkLoggedIn(); OC_Util::checkAppEnabled('contacts'); $bookid = isset($_GET['bookid']) ? $_GET['bookid'] : NULL; $contactid = isset($_GET['contactid']) ? $_GET['contactid'] : NULL; diff --git a/apps/contacts/index.php b/apps/contacts/index.php index a680da3fa97..8f2a561b312 100755 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -9,7 +9,7 @@ // Check if we are a user -OC_Util::checkLoggedIn(); +OCP\User::checkLoggedIn(); OC_Util::checkAppEnabled('contacts'); // Get active address books. This creates a default one if none exists. diff --git a/apps/contacts/photo.php b/apps/contacts/photo.php index f9e62455c13..12d7f370710 100755 --- a/apps/contacts/photo.php +++ b/apps/contacts/photo.php @@ -10,7 +10,7 @@ // Init owncloud -OC_Util::checkLoggedIn(); +OCP\User::checkLoggedIn(); OC_Util::checkAppEnabled('contacts'); function getStandardImage(){ diff --git a/apps/contacts/thumbnail.php b/apps/contacts/thumbnail.php index 1f9fbd7135e..ab5d160135e 100755 --- a/apps/contacts/thumbnail.php +++ b/apps/contacts/thumbnail.php @@ -23,7 +23,7 @@ // Init owncloud OC_JSON::checkLoggedIn(); -//OC_Util::checkLoggedIn(); +//OCP\User::checkLoggedIn(); OC_Util::checkAppEnabled('contacts'); function getStandardImage(){ diff --git a/apps/external/ajax/setsites.php b/apps/external/ajax/setsites.php old mode 100644 new mode 100755 index 3223bf68d9b..5f36b3d13d5 --- a/apps/external/ajax/setsites.php +++ b/apps/external/ajax/setsites.php @@ -7,7 +7,7 @@ */ -OC_Util::checkAdminUser(); +OCP\User::checkAdminUser(); $sites = array(); for ($i = 0; $i < sizeof($_POST['site_name']); $i++) { diff --git a/apps/external/index.php b/apps/external/index.php old mode 100644 new mode 100755 index 0baa62a94b6..1d4e5cc5051 --- a/apps/external/index.php +++ b/apps/external/index.php @@ -23,7 +23,7 @@ require_once('lib/external.php'); -OC_Util::checkLoggedIn(); +OCP\User::checkLoggedIn(); if (isset($_GET['id'])) { diff --git a/apps/external/settings.php b/apps/external/settings.php index a0c4bb0523d..c1a4242c333 100755 --- a/apps/external/settings.php +++ b/apps/external/settings.php @@ -1,6 +1,6 @@ assign('allowResharing', OC_Appconfig::getValue('files_sharing', 'resharing', 'yes')); diff --git a/apps/files_versions/history.php b/apps/files_versions/history.php index d806638e011..eb8886239d3 100755 --- a/apps/files_versions/history.php +++ b/apps/files_versions/history.php @@ -22,7 +22,7 @@ */ require_once( '../../lib/base.php' ); -OC_Util::checkLoggedIn( ); +OCP\User::checkLoggedIn( ); OCP\Util::addStyle('files_versions','versions'); $tmpl = new OC_Template( 'files_versions', 'history', 'user' ); diff --git a/apps/files_versions/settings.php b/apps/files_versions/settings.php index c6312b7be7b..59609de15b4 100755 --- a/apps/files_versions/settings.php +++ b/apps/files_versions/settings.php @@ -1,6 +1,6 @@ . * */ -OC_Util::checkAdminUser(); +OCP\User::checkAdminUser(); OC_Util::checkAppEnabled('user_migrate'); // Import? diff --git a/lib/public/user.php b/lib/public/user.php index febac06730f..b39235bb965 100644 --- a/lib/public/user.php +++ b/lib/public/user.php @@ -84,6 +84,21 @@ class User { return \OC_USER::checkPassword($uid, $password); } + /** + * Check if the user is a admin, redirects to home if not + */ + public static function checkAdminUser(){ + \OC_Util::checkAdminUser(); + } + + /** + * Check if the user is logged in, redirects to home if not. With + * redirect URL parameter to the request URI. + */ + public static function checkLoggedIn(){ + \OC_Util::checkLoggedIn(); + } + } diff --git a/lib/public/util.php b/lib/public/util.php index c4a73a5a7fc..5cfcbaeeffc 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -122,6 +122,15 @@ class Util { + + + + + + + + + } ?>