2013-08-08 17:05:58 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2013-08-28 12:02:27 +02:00
|
|
|
* ownCloud - Documents App
|
2013-08-08 17:05:58 +03:00
|
|
|
*
|
|
|
|
* @author Victor Dubiniuk
|
|
|
|
* @copyright 2013 Victor Dubiniuk victor.dubiniuk@gmail.com
|
|
|
|
*
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
*/
|
|
|
|
|
2013-08-28 12:02:27 +02:00
|
|
|
namespace OCA\Documents;
|
2013-08-08 17:05:58 +03:00
|
|
|
|
|
|
|
class Controller {
|
|
|
|
|
2013-08-18 19:02:48 +03:00
|
|
|
/**
|
|
|
|
* Do security precheck
|
|
|
|
* @param bool callcheck - whether security token check is needed
|
|
|
|
* @return string userId of the currently logged in user
|
|
|
|
*/
|
2013-09-02 19:54:23 +03:00
|
|
|
public static function preDispatch($callcheck = true){
|
2013-08-18 19:02:48 +03:00
|
|
|
if ($callcheck){
|
|
|
|
\OCP\JSON::callCheck();
|
|
|
|
}
|
2013-09-02 19:54:23 +03:00
|
|
|
\OCP\JSON::checkAppEnabled('documents');
|
2013-08-08 19:10:51 +03:00
|
|
|
\OCP\JSON::checkLoggedIn();
|
|
|
|
return \OCP\User::getUser();
|
|
|
|
}
|
2013-09-25 16:34:35 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Do security precheck for not logged in users
|
|
|
|
* @param bool callcheck - whether security token check is needed
|
|
|
|
*/
|
|
|
|
public static function preDispatchGuest($callcheck = true){
|
|
|
|
if ($callcheck){
|
|
|
|
\OCP\JSON::callCheck();
|
|
|
|
}
|
|
|
|
\OCP\JSON::checkAppEnabled('documents');
|
|
|
|
return '(guest)';
|
|
|
|
}
|
2013-08-08 17:05:58 +03:00
|
|
|
|
2013-08-18 19:02:48 +03:00
|
|
|
}
|