ported checkLoggedIn and checkAdmin
This commit is contained in:
parent
e2fb094693
commit
31e32e3c10
26 changed files with 48 additions and 24 deletions
2
apps/admin_migrate/settings.php
Normal file → Executable file
2
apps/admin_migrate/settings.php
Normal file → Executable 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
2
apps/bookmarks/addBm.php
Normal file → Executable 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');
|
||||
|
|
|
@ -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
2
apps/calendar/export.php
Normal file → Executable 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;
|
||||
|
|
|
@ -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
2
apps/contacts/export.php
Normal file → Executable 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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// Init owncloud
|
||||
|
||||
OC_Util::checkLoggedIn();
|
||||
OCP\User::checkLoggedIn();
|
||||
OC_Util::checkAppEnabled('contacts');
|
||||
|
||||
function getStandardImage(){
|
||||
|
|
|
@ -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
2
apps/external/ajax/setsites.php
vendored
Normal file → Executable 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
2
apps/external/index.php
vendored
Normal file → Executable file
|
@ -23,7 +23,7 @@
|
|||
|
||||
require_once('lib/external.php');
|
||||
|
||||
OC_Util::checkLoggedIn();
|
||||
OCP\User::checkLoggedIn();
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
|
||||
|
|
2
apps/external/settings.php
vendored
2
apps/external/settings.php
vendored
|
@ -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
2
apps/files/admin.php
Normal file → Executable 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
2
apps/files/ajax/download.php
Normal file → Executable 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
2
apps/files/download.php
Normal file → Executable file
|
@ -25,7 +25,7 @@
|
|||
|
||||
|
||||
// Check if we are a user
|
||||
OC_Util::checkLoggedIn();
|
||||
OCP\User::checkLoggedIn();
|
||||
|
||||
$filename = $_GET["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" );
|
||||
|
|
|
@ -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" );
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -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' );
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
OC_Util::checkAdminUser();
|
||||
OCP\User::checkAdminUser();
|
||||
|
||||
OCP\Util::addscript( 'files_versions', 'versions' );
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
|
||||
OC_Util::checkLoggedIn();
|
||||
OCP\User::checkLoggedIn();
|
||||
OC_Util::checkAppEnabled('gallery');
|
||||
OC_App::setActiveNavigationEntry( 'gallery_index' );
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -122,6 +122,15 @@ class Util {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue