Change auth checks

This commit is contained in:
Lukas Reschke 2012-10-15 16:41:42 +02:00 committed by Daniel Molkentin
parent 6e045b9ea1
commit 6b39b80648
5 changed files with 9 additions and 19 deletions

View File

@ -3,14 +3,15 @@
// Init owncloud // Init owncloud
require_once '../../lib/base.php'; require_once '../../lib/base.php';
// Check if we are a user
OCP\JSON::callCheck();
OC_JSON::checkLoggedIn();
OC_JSON::verifyUser();
$username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser(); $username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser();
$password = $_POST["password"]; $password = $_POST["password"];
$oldPassword=isset($_POST["oldpassword"])?$_POST["oldpassword"]:''; $oldPassword=isset($_POST["oldpassword"])?$_POST["oldpassword"]:'';
// Check if we are a user
OC_JSON::checkLoggedIn();
OCP\JSON::callCheck();
$userstatus = null; $userstatus = null;
if(OC_Group::inGroup(OC_User::getUser(), 'admin')) { if(OC_Group::inGroup(OC_User::getUser(), 'admin')) {
$userstatus = 'admin'; $userstatus = 'admin';

View File

@ -3,14 +3,7 @@
// Init owncloud // Init owncloud
require_once '../../lib/base.php'; require_once '../../lib/base.php';
OCP\JSON::callCheck(); OCP\JSON::callCheck();
OC_JSON::checkAdminUser();
// Check if we are a user
if( !OC_User::isLoggedIn() || !OC_Group::inGroup( OC_User::getUser(), 'admin' )) {
OC_JSON::error(array("data" => array( "message" => $l->t("Authentication error") )));
exit();
}
OCP\JSON::callCheck();
$groupname = $_POST["groupname"]; $groupname = $_POST["groupname"];

View File

@ -3,13 +3,7 @@
// Init owncloud // Init owncloud
require_once '../../lib/base.php'; require_once '../../lib/base.php';
OCP\JSON::callCheck(); OCP\JSON::callCheck();
OC_JSON::checkSubAdminUser();
// Check if we are a user
if( !OC_User::isLoggedIn() || (!OC_Group::inGroup( OC_User::getUser(), 'admin' ) && !OC_SubAdmin::isSubAdmin(OC_User::getUser()))) {
OC_JSON::error(array("data" => array( "message" => "Authentication error" )));
exit();
}
OCP\JSON::callCheck();
$isadmin = OC_Group::inGroup(OC_User::getUser(), 'admin')?true:false; $isadmin = OC_Group::inGroup(OC_User::getUser(), 'admin')?true:false;

View File

@ -7,6 +7,7 @@
require_once '../lib/base.php'; require_once '../lib/base.php';
OC_Util::checkLoggedIn(); OC_Util::checkLoggedIn();
OC_Util::verifyUser();
// Highlight navigation entry // Highlight navigation entry
OC_Util::addScript( 'settings', 'personal' ); OC_Util::addScript( 'settings', 'personal' );

View File

@ -7,6 +7,7 @@
require_once '../lib/base.php'; require_once '../lib/base.php';
OC_Util::checkLoggedIn(); OC_Util::checkLoggedIn();
OC_Util::verifyUser();
OC_Util::addStyle( 'settings', 'settings' ); OC_Util::addStyle( 'settings', 'settings' );
OC_App::setActiveNavigationEntry( 'settings' ); OC_App::setActiveNavigationEntry( 'settings' );