Use OCP/JSON to check user

This commit is contained in:
Victor Dubiniuk 2013-08-07 23:56:46 +03:00 committed by Tobias Hintze
parent 7b86f75955
commit 9586253c38
4 changed files with 6 additions and 5 deletions

View File

@ -49,10 +49,10 @@ function bogusSession($i){
return $bs; return $bs;
} }
$response = array();
try{ try{
$request = new OCA\Office\Request(); $request = new OCA\Office\Request();
$command = $request->getParam('command'); $command = $request->getParam('command');
$response = array();
switch ($command){ switch ($command){
case 'session-list': case 'session-list':
$response["session_list"] = array(bogusSession(0), bogusSession(1)); $response["session_list"] = array(bogusSession(0), bogusSession(1));

View File

@ -3,7 +3,7 @@
namespace OCA\Office; namespace OCA\Office;
// Check if we are a user // Check if we are a user
\OCP\User::checkLoggedIn(); \OCP\JSON::checkLoggedIn();
$genesis = @$_POST['genesis']; $genesis = @$_POST['genesis'];
@ -18,7 +18,8 @@ if (!$officeView->file_exists($genesis)){
if ($genesisPath){ if ($genesisPath){
$session = Session::getSessionByPath($genesisPath); $session = Session::getSessionByPath($genesisPath);
if (!$session){ if (!$session){
$session = Session::addSession($genesisPath); $hash = View::getHashByGenesis($uid, $genesisPath);
$session = Session::addSession($genesisPath, $hash);
} }
\OCP\JSON::success($session); \OCP\JSON::success($session);
exit(); exit();

View File

@ -2,7 +2,7 @@
namespace OCA\Office; namespace OCA\Office;
\OCP\User::checkLoggedIn(); \OCP\JSON::checkLoggedIn();
\OCP\JSON::success(array( \OCP\JSON::success(array(
'sessions' => Session::getAllSessions() 'sessions' => Session::getAllSessions()

View File

@ -5,7 +5,7 @@ namespace OCA\Office;
class Genesis { class Genesis {
public static function serve($args){ public static function serve($args){
\OCP\User::checkLoggedIn(); \OCP\JSON::checkLoggedIn();
$session = Session::getSession(@$args['es_id']); $session = Session::getSession(@$args['es_id']);