Check if files_sharing is actually enabled before using it

This commit is contained in:
Robin McCorkell 2015-09-09 14:56:49 +01:00
parent a05ccd969c
commit 29dd7d83c4
1 changed files with 11 additions and 9 deletions

View File

@ -104,31 +104,33 @@ API::register(
); );
// Server-to-Server Sharing // Server-to-Server Sharing
$s2s = new \OCA\Files_Sharing\API\Server2Server(); if (\OC::$server->getAppManager()->isEnabledForUser('files_sharing')) {
API::register('post', $s2s = new \OCA\Files_Sharing\API\Server2Server();
API::register('post',
'/cloud/shares', '/cloud/shares',
array($s2s, 'createShare'), array($s2s, 'createShare'),
'files_sharing', 'files_sharing',
API::GUEST_AUTH API::GUEST_AUTH
); );
API::register('post', API::register('post',
'/cloud/shares/{id}/accept', '/cloud/shares/{id}/accept',
array($s2s, 'acceptShare'), array($s2s, 'acceptShare'),
'files_sharing', 'files_sharing',
API::GUEST_AUTH API::GUEST_AUTH
); );
API::register('post', API::register('post',
'/cloud/shares/{id}/decline', '/cloud/shares/{id}/decline',
array($s2s, 'declineShare'), array($s2s, 'declineShare'),
'files_sharing', 'files_sharing',
API::GUEST_AUTH API::GUEST_AUTH
); );
API::register('post', API::register('post',
'/cloud/shares/{id}/unshare', '/cloud/shares/{id}/unshare',
array($s2s, 'unshare'), array($s2s, 'unshare'),
'files_sharing', 'files_sharing',
API::GUEST_AUTH API::GUEST_AUTH
); );
}