public static function setUpBeforeClass() { parent::setUpBeforeClass(); $appManager = \OC::$server->getAppManager(); self::$trashBinStatus = $appManager->isEnabledForUser('files_trashbin'); // reset backend \OC_User::clearBackends(); \OC_User::useBackend('database'); // clear share hooks \OC_Hook::clear('OCP\\Share'); \OC::registerShareHooks(); $application = new \OCA\Files_Sharing\AppInfo\Application(); $application->registerMountProviders(); //disable encryption \OC_App::disable('encryption'); $config = \OC::$server->getConfig(); //configure trashbin self::$rememberRetentionObligation = $config->getSystemValue('trashbin_retention_obligation', Files_Trashbin\Expiration::DEFAULT_RETENTION_OBLIGATION); $config->setSystemValue('trashbin_retention_obligation', 'auto, 2'); // register hooks Files_Trashbin\Trashbin::registerHooks(); // create test user self::loginHelper(self::TEST_TRASHBIN_USER2, true); self::loginHelper(self::TEST_TRASHBIN_USER1, true); }
public static function setUpBeforeClass() { parent::setUpBeforeClass(); $application = new \OCA\Files_Sharing\AppInfo\Application(); $application->registerMountProviders(); // create test user self::loginHelper(self::TEST_VERSIONS_USER2, true); self::loginHelper(self::TEST_VERSIONS_USER, true); }
protected function setUp() { parent::setUp(); \OC_Hook::clear('OC_Filesystem', 'setup'); $application = new \OCA\Files_Sharing\AppInfo\Application(); $application->registerMountProviders(); \OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); $this->datadir = \OC_Config::getValue('datadirectory'); $this->tmpDir = \OC_Helper::tmpFolder(); \OC_Config::setValue('datadirectory', $this->tmpDir); $this->userBackend = new \Test\Util\User\Dummy(); \OC_User::useBackend($this->userBackend); }
protected function setUp() { parent::setUp(); \OC_Hook::clear('OC_Filesystem', 'setup'); $application = new \OCA\Files_Sharing\AppInfo\Application(); $application->registerMountProviders(); \OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); $config = \OC::$server->getConfig(); $this->datadir = $config->getSystemValue('datadirectory'); $this->tmpDir = \OC::$server->getTempManager()->getTemporaryFolder(); $config->setSystemValue('datadirectory', $this->tmpDir); $this->userBackend = new \Test\Util\User\Dummy(); \OC_User::useBackend($this->userBackend); }
$this->create('core_tags_tag', '/tags/{type}/tag/{id}/')->post()->action('OC\\Core\\Tags\\Controller', 'tagAs')->requirements(array('type', 'id')); $this->create('core_tags_untag', '/tags/{type}/untag/{id}/')->post()->action('OC\\Core\\Tags\\Controller', 'unTag')->requirements(array('type', 'id')); $this->create('core_tags_add', '/tags/{type}/add')->post()->action('OC\\Core\\Tags\\Controller', 'addTag')->requirements(array('type')); $this->create('core_tags_delete', '/tags/{type}/delete')->post()->action('OC\\Core\\Tags\\Controller', 'deleteTags')->requirements(array('type')); // oC JS config $this->create('js_config', '/core/js/oc.js')->actionInclude('core/js/config.php'); // Routing $this->create('core_ajax_preview', '/core/preview')->actionInclude('core/ajax/preview.php'); $this->create('core_ajax_preview', '/core/preview.png')->actionInclude('core/ajax/preview.php'); $this->create('core_ajax_update', '/core/ajax/update.php')->actionInclude('core/ajax/update.php'); // Sharing routes $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function ($urlParams) { $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); $app->dispatch('ShareController', 'showShare'); }); $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate')->post()->action(function ($urlParams) { $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); $app->dispatch('ShareController', 'authenticate'); }); $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate')->get()->action(function ($urlParams) { $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); $app->dispatch('ShareController', 'showAuthenticate'); }); $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function ($urlParams) { $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); $app->dispatch('ShareController', 'downloadShare'); }); // used for heartbeat $this->create('heartbeat', '/heartbeat')->action(function () { // do nothing });
* * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ use OCP\API; $application = new \OCA\Files_Sharing\AppInfo\Application(); $application->registerRoutes($this, ['resources' => ['ExternalShares' => ['url' => '/api/externalShares']], 'routes' => [['name' => 'externalShares#testRemote', 'url' => '/testremote', 'verb' => 'GET']]]); /** @var $this \OCP\Route\IRouter */ $this->create('core_ajax_public_preview', '/publicpreview')->action(function () { require_once __DIR__ . '/../ajax/publicpreview.php'; }); $this->create('files_sharing_ajax_list', 'ajax/list.php')->actionInclude('files_sharing/ajax/list.php'); $this->create('files_sharing_ajax_publicpreview', 'ajax/publicpreview.php')->actionInclude('files_sharing/ajax/publicpreview.php'); $this->create('sharing_external_shareinfo', '/shareinfo')->actionInclude('files_sharing/ajax/shareinfo.php'); $this->create('sharing_external_add', '/external')->actionInclude('files_sharing/ajax/external.php'); // OCS API //TODO: SET: mail notification, waiting for PR #4689 to be accepted $OCSShare = new \OCA\Files_Sharing\API\OCSShareWrapper(); API::register('get', '/apps/files_sharing/api/v1/shares', [$OCSShare, 'getAllShares'], 'files_sharing'); API::register('post', '/apps/files_sharing/api/v1/shares', [$OCSShare, 'createShare'], 'files_sharing'); API::register('get', '/apps/files_sharing/api/v1/shares/{id}', [$OCSShare, 'getShare'], 'files_sharing');
* as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ $l = \OC::$server->getL10N('files_sharing'); \OC::$CLASSPATH['OC_Share_Backend_File'] = 'files_sharing/lib/share/file.php'; \OC::$CLASSPATH['OC_Share_Backend_Folder'] = 'files_sharing/lib/share/folder.php'; \OC::$CLASSPATH['OC\\Files\\Storage\\Shared'] = 'files_sharing/lib/sharedstorage.php'; $application = new \OCA\Files_Sharing\AppInfo\Application(); $application->registerMountProviders(); \OCA\Files_Sharing\Helper::registerHooks(); \OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); $eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher->addListener('OCA\\Files::loadAdditionalScripts', function () { \OCP\Util::addScript('files_sharing', 'share'); \OCP\Util::addScript('files_sharing', 'sharetabview'); if (\OC::$server->getConfig()->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes') { \OCP\Util::addScript('files_sharing', 'external'); } \OCP\Util::addStyle('files_sharing', 'sharetabview'); }); // \OCP\Util::addStyle('files_sharing', 'sharetabview'); \OC::$server->getActivityManager()->registerExtension(function () {
// oC JS config $this->create('js_config', '/core/js/oc.js')->actionInclude('core/js/config.php'); // Routing $this->create('core_ajax_preview', '/core/preview')->actionInclude('core/ajax/preview.php'); $this->create('core_ajax_preview', '/core/preview.png')->actionInclude('core/ajax/preview.php'); $this->create('core_ajax_update', '/core/ajax/update.php')->actionInclude('core/ajax/update.php'); // Sharing routes $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function ($urlParams) { $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); $app->dispatch('ShareController', 'showShare'); }); $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate')->post()->action(function ($urlParams) { $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); $app->dispatch('ShareController', 'authenticate'); }); $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate')->get()->action(function ($urlParams) { $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); $app->dispatch('ShareController', 'showAuthenticate'); }); $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function ($urlParams) { $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); $app->dispatch('ShareController', 'downloadShare'); }); $this->create('files_sharing.sharecontroller.viewShare', '/s/{token}/view')->get()->action(function ($urlParams) { $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); $app->dispatch('ShareController', 'viewShare'); }); // used for heartbeat $this->create('heartbeat', '/heartbeat')->action(function () { // do nothing });