ported checkLoggedIn and checkAdmin

This commit is contained in:
Frank Karlitschek 2012-05-01 22:59:38 +02:00
parent e2fb094693
commit 31e32e3c10
26 changed files with 48 additions and 24 deletions

2
apps/admin_migrate/settings.php Normal file → Executable file
View file

@ -22,7 +22,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OC_Util::checkAdminUser();
OCP\User::checkAdminUser();
OC_Util::checkAppEnabled('admin_migrate');
// Export?

2
apps/bookmarks/addBm.php Normal file → Executable file
View file

@ -24,7 +24,7 @@
// Check if we are a user
OC_Util::checkLoggedIn();
OCP\User::checkLoggedIn();
OC_Util::checkAppEnabled('bookmarks');
require_once('bookmarksHelper.php');

View file

@ -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' );

2
apps/calendar/export.php Normal file → Executable file
View file

@ -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;

View file

@ -7,7 +7,7 @@
*/
OC_Util::checkLoggedIn();
OCP\User::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
// Create default calendar ...

2
apps/contacts/export.php Normal file → Executable file
View file

@ -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;

View file

@ -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.

View file

@ -10,7 +10,7 @@
// Init owncloud
OC_Util::checkLoggedIn();
OCP\User::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
function getStandardImage(){

View file

@ -23,7 +23,7 @@
// Init owncloud
OC_JSON::checkLoggedIn();
//OC_Util::checkLoggedIn();
//OCP\User::checkLoggedIn();
OC_Util::checkAppEnabled('contacts');
function getStandardImage(){

2
apps/external/ajax/setsites.php vendored Normal file → Executable file
View file

@ -7,7 +7,7 @@
*/
OC_Util::checkAdminUser();
OCP\User::checkAdminUser();
$sites = array();
for ($i = 0; $i < sizeof($_POST['site_name']); $i++) {

2
apps/external/index.php vendored Normal file → Executable file
View file

@ -23,7 +23,7 @@
require_once('lib/external.php');
OC_Util::checkLoggedIn();
OCP\User::checkLoggedIn();
if (isset($_GET['id'])) {

View file

@ -1,6 +1,6 @@
<?php
OC_Util::checkAdminUser();
OCP\User::checkAdminUser();
OCP\Util::addscript( "external", "admin" );

2
apps/files/admin.php Normal file → Executable file
View file

@ -25,7 +25,7 @@
// Init owncloud
OC_Util::checkAdminUser();
OCP\User::checkAdminUser();
$htaccessWorking=(getenv('htaccessWorking')=='true');

2
apps/files/ajax/download.php Normal file → Executable file
View file

@ -28,7 +28,7 @@ $RUNTIME_APPTYPES=array('filesystem');
// Check if we are a user
OC_Util::checkLoggedIn();
OCP\User::checkLoggedIn();
$files = $_GET["files"];
$dir = $_GET["dir"];

2
apps/files/download.php Normal file → Executable file
View file

@ -25,7 +25,7 @@
// Check if we are a user
OC_Util::checkLoggedIn();
OCP\User::checkLoggedIn();
$filename = $_GET["file"];

View file

@ -22,7 +22,7 @@
*/
// Check if we are a user
OC_Util::checkLoggedIn();
OCP\User::checkLoggedIn();
// Load the files we need
OCP\Util::addStyle( "files", "files" );

View file

@ -26,7 +26,7 @@
// Check if we are a user
OC_Util::checkLoggedIn();
OCP\User::checkLoggedIn();
// Load the files we need
OCP\Util::addStyle( "files", "files" );

View file

@ -23,7 +23,7 @@
require_once('lib_share.php');
OC_Util::checkLoggedIn();
OCP\User::checkLoggedIn();
OC_Util::checkAppEnabled('files_sharing');
OC_App::setActiveNavigationEntry("files_sharing_list");

View file

@ -1,6 +1,6 @@
<?php
OC_Util::checkAdminUser();
OCP\User::checkAdminUser();
OCP\Util::addscript('files_sharing', 'settings');
$tmpl = new OC_Template('files_sharing', 'settings');
$tmpl->assign('allowResharing', OC_Appconfig::getValue('files_sharing', 'resharing', 'yes'));

View file

@ -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' );

View file

@ -1,6 +1,6 @@
<?php
OC_Util::checkAdminUser();
OCP\User::checkAdminUser();
OCP\Util::addscript( 'files_versions', 'versions' );

View file

@ -23,7 +23,7 @@
OC_Util::checkLoggedIn();
OCP\User::checkLoggedIn();
OC_Util::checkAppEnabled('gallery');
OC_App::setActiveNavigationEntry( 'gallery_index' );

View file

@ -25,7 +25,7 @@
// Check if we are a user
OC_Util::checkLoggedIn();
OCP\User::checkLoggedIn();
OC_Util::checkAppEnabled('media');
require_once(OC::$APPSROOT . '/apps/media/lib_collection.php');

View file

@ -20,7 +20,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OC_Util::checkAdminUser();
OCP\User::checkAdminUser();
OC_Util::checkAppEnabled('user_migrate');
// Import?

View file

@ -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();
}
}

View file

@ -122,6 +122,15 @@ class Util {
}
?>