diff options
Diffstat (limited to 'apps/files_sharing')
22 files changed, 248 insertions, 706 deletions
diff --git a/apps/files_sharing/api/server2server.php b/apps/files_sharing/api/server2server.php deleted file mode 100644 index 034ec5105e4..00000000000 --- a/apps/files_sharing/api/server2server.php +++ /dev/null @@ -1,325 +0,0 @@ -<?php -/** - * @author Arthur Schiwon <blizzz@owncloud.com> - * @author Björn Schießle <schiessle@owncloud.com> - * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Lukas Reschke <lukas@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * 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/> - * - */ - -namespace OCA\Files_Sharing\API; - -use OCA\FederatedFileSharing\DiscoveryManager; -use OCA\FederatedFileSharing\FederatedShareProvider; -use OCA\Files_Sharing\Activity; -use OCP\Files\NotFoundException; - -class Server2Server { - - /** @var FederatedShareProvider */ - private $federatedShareProvider; - - - /** - * Server2Server constructor. - * - * @param FederatedShareProvider $federatedShareProvider - */ - public function __construct(FederatedShareProvider $federatedShareProvider) { - $this->federatedShareProvider = $federatedShareProvider; - } - - /** - * create a new share - * - * @param array $params - * @return \OC_OCS_Result - */ - public function createShare($params) { - - if (!$this->isS2SEnabled(true)) { - return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); - } - - $remote = isset($_POST['remote']) ? $_POST['remote'] : null; - $token = isset($_POST['token']) ? $_POST['token'] : null; - $name = isset($_POST['name']) ? $_POST['name'] : null; - $owner = isset($_POST['owner']) ? $_POST['owner'] : null; - $shareWith = isset($_POST['shareWith']) ? $_POST['shareWith'] : null; - $remoteId = isset($_POST['remoteId']) ? (int)$_POST['remoteId'] : null; - - if ($remote && $token && $name && $owner && $remoteId && $shareWith) { - - if(!\OCP\Util::isValidFileName($name)) { - return new \OC_OCS_Result(null, 400, 'The mountpoint name contains invalid characters.'); - } - - // FIXME this should be a method in the user management instead - \OCP\Util::writeLog('files_sharing', 'shareWith before, ' . $shareWith, \OCP\Util::DEBUG); - \OCP\Util::emitHook( - '\OCA\Files_Sharing\API\Server2Server', - 'preLoginNameUsedAsUserName', - array('uid' => &$shareWith) - ); - \OCP\Util::writeLog('files_sharing', 'shareWith after, ' . $shareWith, \OCP\Util::DEBUG); - - if (!\OCP\User::userExists($shareWith)) { - return new \OC_OCS_Result(null, 400, 'User does not exists'); - } - - \OC_Util::setupFS($shareWith); - - $discoveryManager = new DiscoveryManager( - \OC::$server->getMemCacheFactory(), - \OC::$server->getHTTPClientService() - ); - $externalManager = new \OCA\Files_Sharing\External\Manager( - \OC::$server->getDatabaseConnection(), - \OC\Files\Filesystem::getMountManager(), - \OC\Files\Filesystem::getLoader(), - \OC::$server->getHTTPHelper(), - \OC::$server->getNotificationManager(), - $discoveryManager, - $shareWith - ); - - try { - $externalManager->addShare($remote, $token, '', $name, $owner, false, $shareWith, $remoteId); - $shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external'); - - $user = $owner . '@' . $this->cleanupRemote($remote); - - \OC::$server->getActivityManager()->publishActivity( - Activity::FILES_SHARING_APP, Activity::SUBJECT_REMOTE_SHARE_RECEIVED, array($user, trim($name, '/')), '', array(), - '', '', $shareWith, Activity::TYPE_REMOTE_SHARE, Activity::PRIORITY_LOW); - - $urlGenerator = \OC::$server->getURLGenerator(); - - $notificationManager = \OC::$server->getNotificationManager(); - $notification = $notificationManager->createNotification(); - $notification->setApp('files_sharing') - ->setUser($shareWith) - ->setDateTime(new \DateTime()) - ->setObject('remote_share', $shareId) - ->setSubject('remote_share', [$user, trim($name, '/')]); - - $declineAction = $notification->createAction(); - $declineAction->setLabel('decline') - ->setLink($urlGenerator->getAbsoluteURL($urlGenerator->linkTo('', 'ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); - $notification->addAction($declineAction); - - $acceptAction = $notification->createAction(); - $acceptAction->setLabel('accept') - ->setLink($urlGenerator->getAbsoluteURL($urlGenerator->linkTo('', 'ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); - $notification->addAction($acceptAction); - - $notificationManager->notify($notification); - - return new \OC_OCS_Result(); - } catch (\Exception $e) { - \OCP\Util::writeLog('files_sharing', 'server can not add remote share, ' . $e->getMessage(), \OCP\Util::ERROR); - return new \OC_OCS_Result(null, 500, 'internal server error, was not able to add share from ' . $remote); - } - } - - return new \OC_OCS_Result(null, 400, 'server can not add remote share, missing parameter'); - } - - /** - * accept server-to-server share - * - * @param array $params - * @return \OC_OCS_Result - */ - public function acceptShare($params) { - - if (!$this->isS2SEnabled()) { - return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); - } - - $id = $params['id']; - $token = isset($_POST['token']) ? $_POST['token'] : null; - $share = self::getShare($id, $token); - - if ($share) { - list($file, $link) = self::getFile($share['uid_owner'], $share['file_source']); - - $event = \OC::$server->getActivityManager()->generateEvent(); - $event->setApp(Activity::FILES_SHARING_APP) - ->setType(Activity::TYPE_REMOTE_SHARE) - ->setAffectedUser($share['uid_owner']) - ->setSubject(Activity::SUBJECT_REMOTE_SHARE_ACCEPTED, [$share['share_with'], basename($file)]) - ->setObject('files', $share['file_source'], $file) - ->setLink($link); - \OC::$server->getActivityManager()->publish($event); - } - - return new \OC_OCS_Result(); - } - - /** - * decline server-to-server share - * - * @param array $params - * @return \OC_OCS_Result - */ - public function declineShare($params) { - - if (!$this->isS2SEnabled()) { - return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); - } - - $id = $params['id']; - $token = isset($_POST['token']) ? $_POST['token'] : null; - - $share = $this->getShare($id, $token); - - if ($share) { - // userId must be set to the user who unshares - \OCP\Share::unshare($share['item_type'], $share['item_source'], $share['share_type'], $share['share_with'], $share['uid_owner']); - - list($file, $link) = $this->getFile($share['uid_owner'], $share['file_source']); - - $event = \OC::$server->getActivityManager()->generateEvent(); - $event->setApp(Activity::FILES_SHARING_APP) - ->setType(Activity::TYPE_REMOTE_SHARE) - ->setAffectedUser($share['uid_owner']) - ->setSubject(Activity::SUBJECT_REMOTE_SHARE_DECLINED, [$share['share_with'], basename($file)]) - ->setObject('files', $share['file_source'], $file) - ->setLink($link); - \OC::$server->getActivityManager()->publish($event); - } - - return new \OC_OCS_Result(); - } - - /** - * remove server-to-server share if it was unshared by the owner - * - * @param array $params - * @return \OC_OCS_Result - */ - public function unshare($params) { - - if (!$this->isS2SEnabled()) { - return new \OC_OCS_Result(null, 503, 'Server does not support federated cloud sharing'); - } - - $id = $params['id']; - $token = isset($_POST['token']) ? $_POST['token'] : null; - - $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share_external` WHERE `remote_id` = ? AND `share_token` = ?'); - $query->execute(array($id, $token)); - $share = $query->fetchRow(); - - if ($token && $id && !empty($share)) { - - $remote = $this->cleanupRemote($share['remote']); - - $owner = $share['owner'] . '@' . $remote; - $mountpoint = $share['mountpoint']; - $user = $share['user']; - - $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share_external` WHERE `remote_id` = ? AND `share_token` = ?'); - $query->execute(array($id, $token)); - - if ($share['accepted']) { - $path = trim($mountpoint, '/'); - } else { - $path = trim($share['name'], '/'); - } - - $notificationManager = \OC::$server->getNotificationManager(); - $notification = $notificationManager->createNotification(); - $notification->setApp('files_sharing') - ->setUser($share['user']) - ->setObject('remote_share', (int) $share['id']); - $notificationManager->markProcessed($notification); - - \OC::$server->getActivityManager()->publishActivity( - Activity::FILES_SHARING_APP, Activity::SUBJECT_REMOTE_SHARE_UNSHARED, array($owner, $path), '', array(), - '', '', $user, Activity::TYPE_REMOTE_SHARE, Activity::PRIORITY_MEDIUM); - } - - return new \OC_OCS_Result(); - } - - private function cleanupRemote($remote) { - $remote = substr($remote, strpos($remote, '://') + 3); - - return rtrim($remote, '/'); - } - - /** - * get share - * - * @param int $id - * @param string $token - * @return array - */ - private function getShare($id, $token) { - $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `id` = ? AND `token` = ? AND `share_type` = ?'); - $query->execute(array($id, $token, \OCP\Share::SHARE_TYPE_REMOTE)); - $share = $query->fetchRow(); - - return $share; - } - - /** - * get file - * - * @param string $user - * @param int $fileSource - * @return array with internal path of the file and a absolute link to it - */ - private function getFile($user, $fileSource) { - \OC_Util::setupFS($user); - - try { - $file = \OC\Files\Filesystem::getPath($fileSource); - } catch (NotFoundException $e) { - $file = null; - } - $args = \OC\Files\Filesystem::is_dir($file) ? array('dir' => $file) : array('dir' => dirname($file), 'scrollto' => $file); - $link = \OCP\Util::linkToAbsolute('files', 'index.php', $args); - - return array($file, $link); - - } - - /** - * check if server-to-server sharing is enabled - * - * @param bool $incoming - * @return bool - */ - private function isS2SEnabled($incoming = false) { - - $result = \OCP\App::isEnabled('files_sharing'); - - if ($incoming) { - $result = $result && $this->federatedShareProvider->isIncomingServer2serverShareEnabled(); - } else { - $result = $result && $this->federatedShareProvider->isOutgoingServer2serverShareEnabled(); - } - - return $result; - } - -} diff --git a/apps/files_sharing/api/share20ocs.php b/apps/files_sharing/api/share20ocs.php index af762845326..28166b943b8 100644 --- a/apps/files_sharing/api/share20ocs.php +++ b/apps/files_sharing/api/share20ocs.php @@ -99,7 +99,15 @@ class Share20OCS { */ protected function formatShare(\OCP\Share\IShare $share) { $sharedBy = $this->userManager->get($share->getSharedBy()); - $shareOwner = $this->userManager->get($share->getShareOwner()); + // for federated shares the owner can be a remote user, in this + // case we use the initiator + if ($this->userManager->userExists($share->getShareOwner())) { + $shareOwner = $this->userManager->get($share->getShareOwner()); + $localUser = $share->getShareOwner(); + } else { + $shareOwner = $this->userManager->get($share->getSharedBy()); + $localUser = $share->getSharedBy(); + } $result = [ 'id' => $share->getId(), 'share_type' => $share->getShareType(), @@ -115,7 +123,7 @@ class Share20OCS { ]; $node = $share->getNode(); - $result['path'] = $this->rootFolder->getUserFolder($share->getShareOwner())->getRelativePath($node->getPath()); + $result['path'] = $this->rootFolder->getUserFolder($localUser)->getRelativePath($node->getPath()); if ($node instanceOf \OCP\Files\Folder) { $result['item_type'] = 'folder'; } else { diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index da573d11ec5..32eee9b6c9c 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -103,15 +103,3 @@ if ($config->getAppValue('core', 'shareapi_enabled', 'yes') === 'yes') { } } } - -$manager = \OC::$server->getNotificationManager(); -$manager->registerNotifier(function() { - return new \OCA\Files_Sharing\Notifier( - \OC::$server->getL10NFactory() - ); -}, function() use ($l) { - return [ - 'id' => 'files_sharing', - 'name' => $l->t('Federated sharing'), - ]; -}); diff --git a/apps/files_sharing/l10n/cs_CZ.js b/apps/files_sharing/l10n/cs_CZ.js index f6e937a723d..aba62f0811b 100644 --- a/apps/files_sharing/l10n/cs_CZ.js +++ b/apps/files_sharing/l10n/cs_CZ.js @@ -9,16 +9,16 @@ OC.L10N.register( "Storage not valid" : "Úložiště není platné", "Couldn't add remote share" : "Nelze přidat vzdálené úložiště", "Share API is disabled" : "Sdílení API je zakázané", - "Wrong share ID, share doesn't exist" : "Špatné sdílení ID, sdílení neexistuje", + "Wrong share ID, share doesn't exist" : "Špatné ID sdílení, sdílení neexistuje", "Could not delete share" : "Nelze smazat sdílení", - "Please specify a file or folder path" : "Prosím zadejte cestu složky nebo souboru", - "Wrong path, file/folder doesn't exist" : "Špatná cesta, soubor/složka neexistuje", + "Please specify a file or folder path" : "Prosím zadejte cestu adresáře nebo souboru", + "Wrong path, file/folder doesn't exist" : "Špatná cesta, soubor/adresář neexistuje", "Please specify a valid user" : "Prosím zadejte platného uživatele", "Group sharing is disabled by the administrator" : "Skupinové sdílení bylo zakázáno administrátorem", "Please specify a valid group" : "Prosím zadejte platnou skupinu", "Public link sharing is disabled by the administrator" : "Veřejný odkaz sdílení je zakázán administrátorem", "Public upload disabled by the administrator" : "Veřejné nahrávání zakázáno administrátorem", - "Public upload is only possible for publicly shared folders" : "Veřejné nahrávání je možné pouze pro sdílení veřejných složek", + "Public upload is only possible for publicly shared folders" : "Veřejné nahrávání je možné pouze do veřejně sdílených adresářů", "Invalid date, date format must be YYYY-MM-DD" : "Neplatné datum, formát data musí být YYY-MM-DD", "Sharing %s failed because the back end does not allow shares from type %s" : "Sdílení %s selhalo, podpůrná vrstva nepodporuje typ sdílení %s", "Unknown share type" : "Neznámý typ sdílení", @@ -47,8 +47,8 @@ OC.L10N.register( "Invalid ownCloud url" : "Neplatná ownCloud url", "Shared by" : "Sdílí", "Sharing" : "Sdílení", - "A file or folder has been <strong>shared</strong>" : "Soubor nebo složka byla <strong>nasdílena</strong>", - "A file or folder was shared from <strong>another server</strong>" : "Soubor nebo složka byla nasdílena z <strong>jiného serveru</strong>", + "A file or folder has been <strong>shared</strong>" : "Soubor nebo adresář byl <strong>nasdílen</strong>", + "A file or folder was shared from <strong>another server</strong>" : "Soubor nebo adresář byl nasdílen z <strong>jiného serveru</strong>", "A public shared file or folder was <strong>downloaded</strong>" : "Byl <strong>stažen</strong> veřejně sdílený soubor nebo adresář", "You received a new remote share %2$s from %1$s" : "Obdrželi jste nové vzdálené sdílení %2$s od uživatele %1$s", "You received a new remote share from %s" : "Obdrželi jste nové vzdálené sdílení z %s", diff --git a/apps/files_sharing/l10n/cs_CZ.json b/apps/files_sharing/l10n/cs_CZ.json index 45c81e4e4e0..74877e2f2fa 100644 --- a/apps/files_sharing/l10n/cs_CZ.json +++ b/apps/files_sharing/l10n/cs_CZ.json @@ -7,16 +7,16 @@ "Storage not valid" : "Úložiště není platné", "Couldn't add remote share" : "Nelze přidat vzdálené úložiště", "Share API is disabled" : "Sdílení API je zakázané", - "Wrong share ID, share doesn't exist" : "Špatné sdílení ID, sdílení neexistuje", + "Wrong share ID, share doesn't exist" : "Špatné ID sdílení, sdílení neexistuje", "Could not delete share" : "Nelze smazat sdílení", - "Please specify a file or folder path" : "Prosím zadejte cestu složky nebo souboru", - "Wrong path, file/folder doesn't exist" : "Špatná cesta, soubor/složka neexistuje", + "Please specify a file or folder path" : "Prosím zadejte cestu adresáře nebo souboru", + "Wrong path, file/folder doesn't exist" : "Špatná cesta, soubor/adresář neexistuje", "Please specify a valid user" : "Prosím zadejte platného uživatele", "Group sharing is disabled by the administrator" : "Skupinové sdílení bylo zakázáno administrátorem", "Please specify a valid group" : "Prosím zadejte platnou skupinu", "Public link sharing is disabled by the administrator" : "Veřejný odkaz sdílení je zakázán administrátorem", "Public upload disabled by the administrator" : "Veřejné nahrávání zakázáno administrátorem", - "Public upload is only possible for publicly shared folders" : "Veřejné nahrávání je možné pouze pro sdílení veřejných složek", + "Public upload is only possible for publicly shared folders" : "Veřejné nahrávání je možné pouze do veřejně sdílených adresářů", "Invalid date, date format must be YYYY-MM-DD" : "Neplatné datum, formát data musí být YYY-MM-DD", "Sharing %s failed because the back end does not allow shares from type %s" : "Sdílení %s selhalo, podpůrná vrstva nepodporuje typ sdílení %s", "Unknown share type" : "Neznámý typ sdílení", @@ -45,8 +45,8 @@ "Invalid ownCloud url" : "Neplatná ownCloud url", "Shared by" : "Sdílí", "Sharing" : "Sdílení", - "A file or folder has been <strong>shared</strong>" : "Soubor nebo složka byla <strong>nasdílena</strong>", - "A file or folder was shared from <strong>another server</strong>" : "Soubor nebo složka byla nasdílena z <strong>jiného serveru</strong>", + "A file or folder has been <strong>shared</strong>" : "Soubor nebo adresář byl <strong>nasdílen</strong>", + "A file or folder was shared from <strong>another server</strong>" : "Soubor nebo adresář byl nasdílen z <strong>jiného serveru</strong>", "A public shared file or folder was <strong>downloaded</strong>" : "Byl <strong>stažen</strong> veřejně sdílený soubor nebo adresář", "You received a new remote share %2$s from %1$s" : "Obdrželi jste nové vzdálené sdílení %2$s od uživatele %1$s", "You received a new remote share from %s" : "Obdrželi jste nové vzdálené sdílení z %s", diff --git a/apps/files_sharing/l10n/es.js b/apps/files_sharing/l10n/es.js index 964aef9e0df..961cf47b2f1 100644 --- a/apps/files_sharing/l10n/es.js +++ b/apps/files_sharing/l10n/es.js @@ -8,8 +8,24 @@ OC.L10N.register( "Could not authenticate to remote share, password might be wrong" : "No se ha podido autenticar para compartir remotamente, quizás esté mal la contraseña", "Storage not valid" : "Almacenamiento inválido", "Couldn't add remote share" : "No se puede añadir un compartido remoto", + "Share API is disabled" : "El API de compartir está deshabilitado", + "Wrong share ID, share doesn't exist" : "El ID del recurso compartido no es correcto, el recurso compartido no existe", + "Could not delete share" : "No se ha podido eliminar el recurso compartido", + "Please specify a file or folder path" : "Por favor, especifica la ubicación de un archivo o carpeta", + "Wrong path, file/folder doesn't exist" : "Ubicación incorrecta, el archivo/carpeta no existe", + "Please specify a valid user" : "Por favor, especifica un usuario válido", + "Group sharing is disabled by the administrator" : "Compartir en grupo está deshabilitado por el administrador", + "Please specify a valid group" : "Por favor, especifica un grupo válido", + "Public link sharing is disabled by the administrator" : "Compartir enlaces de forma pública está deshabilitado por el administrador", + "Public upload disabled by the administrator" : "La subida pública está deshabilitado por el administrador", + "Public upload is only possible for publicly shared folders" : "La subida publica solo es posible poara las carpetas publicas compartidas", "Invalid date, date format must be YYYY-MM-DD" : "Fecha inválida, el formato de las fechas debe ser YYYY-MM-DD", + "Sharing %s failed because the back end does not allow shares from type %s" : "Compartir %s ha fallado porque el repositorio no admite compartidos del tipo %s", + "Unknown share type" : "Tipo desconocido de recurso compartido", "Not a directory" : "No es un directorio", + "Could not lock path" : "No se ha podido bloquear la ruta", + "Can't change permissions for public share links" : "No se pueden cambiar los permisos para los enlaces de recursos compartidos públicos", + "Wrong or no update parameter given" : "No se ha suministrado un parametro correcto", "Cannot increase permissions" : "No es posible aumentar permisos", "Shared with you" : "Compartido contigo", "Shared with others" : "Compartido con otros", diff --git a/apps/files_sharing/l10n/es.json b/apps/files_sharing/l10n/es.json index 172de7e3f47..1acacc064e7 100644 --- a/apps/files_sharing/l10n/es.json +++ b/apps/files_sharing/l10n/es.json @@ -6,8 +6,24 @@ "Could not authenticate to remote share, password might be wrong" : "No se ha podido autenticar para compartir remotamente, quizás esté mal la contraseña", "Storage not valid" : "Almacenamiento inválido", "Couldn't add remote share" : "No se puede añadir un compartido remoto", + "Share API is disabled" : "El API de compartir está deshabilitado", + "Wrong share ID, share doesn't exist" : "El ID del recurso compartido no es correcto, el recurso compartido no existe", + "Could not delete share" : "No se ha podido eliminar el recurso compartido", + "Please specify a file or folder path" : "Por favor, especifica la ubicación de un archivo o carpeta", + "Wrong path, file/folder doesn't exist" : "Ubicación incorrecta, el archivo/carpeta no existe", + "Please specify a valid user" : "Por favor, especifica un usuario válido", + "Group sharing is disabled by the administrator" : "Compartir en grupo está deshabilitado por el administrador", + "Please specify a valid group" : "Por favor, especifica un grupo válido", + "Public link sharing is disabled by the administrator" : "Compartir enlaces de forma pública está deshabilitado por el administrador", + "Public upload disabled by the administrator" : "La subida pública está deshabilitado por el administrador", + "Public upload is only possible for publicly shared folders" : "La subida publica solo es posible poara las carpetas publicas compartidas", "Invalid date, date format must be YYYY-MM-DD" : "Fecha inválida, el formato de las fechas debe ser YYYY-MM-DD", + "Sharing %s failed because the back end does not allow shares from type %s" : "Compartir %s ha fallado porque el repositorio no admite compartidos del tipo %s", + "Unknown share type" : "Tipo desconocido de recurso compartido", "Not a directory" : "No es un directorio", + "Could not lock path" : "No se ha podido bloquear la ruta", + "Can't change permissions for public share links" : "No se pueden cambiar los permisos para los enlaces de recursos compartidos públicos", + "Wrong or no update parameter given" : "No se ha suministrado un parametro correcto", "Cannot increase permissions" : "No es posible aumentar permisos", "Shared with you" : "Compartido contigo", "Shared with others" : "Compartido con otros", diff --git a/apps/files_sharing/l10n/lv.js b/apps/files_sharing/l10n/lv.js index abc9d4ce301..41fcffb93ff 100644 --- a/apps/files_sharing/l10n/lv.js +++ b/apps/files_sharing/l10n/lv.js @@ -7,6 +7,22 @@ OC.L10N.register( "Could not authenticate to remote share, password might be wrong" : "Nesanāca autentificēties pie attālinātās koplietotnes, parole varētu būt nepareiza", "Storage not valid" : "Glabātuve nav derīga", "Couldn't add remote share" : "Nevarēja pievienot attālināto koplietotni", + "Share API is disabled" : "Koplietošanas API ir atslēgta", + "Wrong share ID, share doesn't exist" : "Nepareizs koplietošanas ID, koplietotne neeksistē", + "Could not delete share" : "Neizdevās dzēst koplietotni", + "Please specify a file or folder path" : "Lūdzu norādiet datnes vai mapes ceļu", + "Wrong path, file/folder doesn't exist" : "Nepareizs ceļš, datne/mape neeksistē", + "Please specify a valid user" : "Lūdzu norādiet derīgu lietotāju", + "Group sharing is disabled by the administrator" : "Administrators grupas koplietošanu ir atslēdzis", + "Please specify a valid group" : "Lūdzu norādiet derīgu grupu", + "Public link sharing is disabled by the administrator" : "Administrators publisku saites koplietošanu ir atslēdzis", + "Public upload disabled by the administrator" : "Administrators publisku augšupielādi ir atslēdzis", + "Public upload is only possible for publicly shared folders" : "Publiska augšupielāde iespējama tikai publiski koplietotām mapēm", + "Invalid date, date format must be YYYY-MM-DD" : "Nepareizs datums, datumam jābūt YYYY-MM-DD formātā", + "Unknown share type" : "Nezināms koplietošanas tips", + "Could not lock path" : "Nevarēja bloķēt ceļu", + "Can't change permissions for public share links" : "Publiskai koplietošanas saitei nevar mainīt tiesības", + "Cannot increase permissions" : "Nevar palielināt tiesības", "Shared with you" : "Koplietots ar tevi", "Shared with others" : "Koplietots ar citiem", "Shared by link" : "Koplietots ar saiti", @@ -21,6 +37,7 @@ OC.L10N.register( "Remote share password" : "Attālinātās koplietotnes parole", "Cancel" : "Atcelt", "Add remote share" : "Pievienot attālināto koplietotni", + "You can upload into this folder" : "Jūs variet augšuplādēt šajā mapē", "No ownCloud installation (7 or higher) found at {remote}" : "Nav atrasta neviena ownCloud (7. vai augstāka) instalācija {remote}", "Invalid ownCloud url" : "Nederīga ownCloud saite", "Shared by" : "Dalījās", @@ -28,6 +45,7 @@ OC.L10N.register( "A file or folder has been <strong>shared</strong>" : "<strong>Koplietota</strong> fails vai mape", "A file or folder was shared from <strong>another server</strong>" : "Fails vai mape tika koplietota no <strong>cita servera</strong>", "A public shared file or folder was <strong>downloaded</strong>" : "Publiski koplietots fails vai mape tika <strong>lejupielādēts</strong>", + "You received a new remote share %2$s from %1$s" : "Jūs saņēmāt jaunu attālinātu koplietotni %2$s no %1$s", "You received a new remote share from %s" : "Saņēmāt jaunu attālinātu koplietotni no %s", "%1$s accepted remote share %2$s" : "%1$s apstiprināja attālināto koplietotni %2$s", "%1$s declined remote share %2$s" : "%1$s noraidīja attālināto koplietotni %2$s", @@ -35,7 +53,13 @@ OC.L10N.register( "Public shared folder %1$s was downloaded" : "Publiski koplietota mape %1$s tika lejupielādēta", "Public shared file %1$s was downloaded" : "Publiski koplietots fails %1$s tika lejupielādēts", "You shared %1$s with %2$s" : "Tu koplietoji %1$s ar %2$s", + "%2$s shared %1$s with %3$s" : "%2$s koplietots %1$s ar %3$s", + "You removed the share of %2$s for %1$s" : "Tu noņēmi koplietošanu no %2$s priekš %1$s", + "%2$s removed the share of %3$s for %1$s" : "%2$s noņēma koplietošanu no %3$s priekš %1$s", "You shared %1$s with group %2$s" : "Tu koplietoji %1$s ar grupu %2$s", + "%2$s shared %1$s with group %3$s" : "%2$s koplietots %1$s ar grupu %3$s", + "You removed the share of group %2$s for %1$s" : "Tu noņēmi koplietošanu no grupas %2$s priekš %1$s", + "%2$s removed the share of group %3$s for %1$s" : "%2$s noņēma koplietošanu no gruapas %3$s priekš %1$s", "You shared %1$s via link" : "Tu koplietoji %1$s , izmantojot saiti", "%2$s shared %1$s with you" : "%2$s koplietoja %1$s ar tevi", "Shares" : "Koplietotie", diff --git a/apps/files_sharing/l10n/lv.json b/apps/files_sharing/l10n/lv.json index 5ea0c87b814..c4557eed842 100644 --- a/apps/files_sharing/l10n/lv.json +++ b/apps/files_sharing/l10n/lv.json @@ -5,6 +5,22 @@ "Could not authenticate to remote share, password might be wrong" : "Nesanāca autentificēties pie attālinātās koplietotnes, parole varētu būt nepareiza", "Storage not valid" : "Glabātuve nav derīga", "Couldn't add remote share" : "Nevarēja pievienot attālināto koplietotni", + "Share API is disabled" : "Koplietošanas API ir atslēgta", + "Wrong share ID, share doesn't exist" : "Nepareizs koplietošanas ID, koplietotne neeksistē", + "Could not delete share" : "Neizdevās dzēst koplietotni", + "Please specify a file or folder path" : "Lūdzu norādiet datnes vai mapes ceļu", + "Wrong path, file/folder doesn't exist" : "Nepareizs ceļš, datne/mape neeksistē", + "Please specify a valid user" : "Lūdzu norādiet derīgu lietotāju", + "Group sharing is disabled by the administrator" : "Administrators grupas koplietošanu ir atslēdzis", + "Please specify a valid group" : "Lūdzu norādiet derīgu grupu", + "Public link sharing is disabled by the administrator" : "Administrators publisku saites koplietošanu ir atslēdzis", + "Public upload disabled by the administrator" : "Administrators publisku augšupielādi ir atslēdzis", + "Public upload is only possible for publicly shared folders" : "Publiska augšupielāde iespējama tikai publiski koplietotām mapēm", + "Invalid date, date format must be YYYY-MM-DD" : "Nepareizs datums, datumam jābūt YYYY-MM-DD formātā", + "Unknown share type" : "Nezināms koplietošanas tips", + "Could not lock path" : "Nevarēja bloķēt ceļu", + "Can't change permissions for public share links" : "Publiskai koplietošanas saitei nevar mainīt tiesības", + "Cannot increase permissions" : "Nevar palielināt tiesības", "Shared with you" : "Koplietots ar tevi", "Shared with others" : "Koplietots ar citiem", "Shared by link" : "Koplietots ar saiti", @@ -19,6 +35,7 @@ "Remote share password" : "Attālinātās koplietotnes parole", "Cancel" : "Atcelt", "Add remote share" : "Pievienot attālināto koplietotni", + "You can upload into this folder" : "Jūs variet augšuplādēt šajā mapē", "No ownCloud installation (7 or higher) found at {remote}" : "Nav atrasta neviena ownCloud (7. vai augstāka) instalācija {remote}", "Invalid ownCloud url" : "Nederīga ownCloud saite", "Shared by" : "Dalījās", @@ -26,6 +43,7 @@ "A file or folder has been <strong>shared</strong>" : "<strong>Koplietota</strong> fails vai mape", "A file or folder was shared from <strong>another server</strong>" : "Fails vai mape tika koplietota no <strong>cita servera</strong>", "A public shared file or folder was <strong>downloaded</strong>" : "Publiski koplietots fails vai mape tika <strong>lejupielādēts</strong>", + "You received a new remote share %2$s from %1$s" : "Jūs saņēmāt jaunu attālinātu koplietotni %2$s no %1$s", "You received a new remote share from %s" : "Saņēmāt jaunu attālinātu koplietotni no %s", "%1$s accepted remote share %2$s" : "%1$s apstiprināja attālināto koplietotni %2$s", "%1$s declined remote share %2$s" : "%1$s noraidīja attālināto koplietotni %2$s", @@ -33,7 +51,13 @@ "Public shared folder %1$s was downloaded" : "Publiski koplietota mape %1$s tika lejupielādēta", "Public shared file %1$s was downloaded" : "Publiski koplietots fails %1$s tika lejupielādēts", "You shared %1$s with %2$s" : "Tu koplietoji %1$s ar %2$s", + "%2$s shared %1$s with %3$s" : "%2$s koplietots %1$s ar %3$s", + "You removed the share of %2$s for %1$s" : "Tu noņēmi koplietošanu no %2$s priekš %1$s", + "%2$s removed the share of %3$s for %1$s" : "%2$s noņēma koplietošanu no %3$s priekš %1$s", "You shared %1$s with group %2$s" : "Tu koplietoji %1$s ar grupu %2$s", + "%2$s shared %1$s with group %3$s" : "%2$s koplietots %1$s ar grupu %3$s", + "You removed the share of group %2$s for %1$s" : "Tu noņēmi koplietošanu no grupas %2$s priekš %1$s", + "%2$s removed the share of group %3$s for %1$s" : "%2$s noņēma koplietošanu no gruapas %3$s priekš %1$s", "You shared %1$s via link" : "Tu koplietoji %1$s , izmantojot saiti", "%2$s shared %1$s with you" : "%2$s koplietoja %1$s ar tevi", "Shares" : "Koplietotie", diff --git a/apps/files_sharing/l10n/ro.js b/apps/files_sharing/l10n/ro.js index 751da9881cd..ac3de75f4e2 100644 --- a/apps/files_sharing/l10n/ro.js +++ b/apps/files_sharing/l10n/ro.js @@ -11,6 +11,8 @@ OC.L10N.register( "Nothing shared with you yet" : "Nimic nu e partajat cu tine încă", "Nothing shared yet" : "Nimic partajat încă", "Cancel" : "Anulare", + "No ownCloud installation (7 or higher) found at {remote}" : "Nu s-a găsit nicio instanță ownCloud (versiunea 7 sau mai mare) la {remote}", + "Invalid ownCloud url" : "URL ownCloud invalid", "Shared by" : "impartite in ", "Sharing" : "Partajare", "A file or folder has been <strong>shared</strong>" : "Un fișier sau director a fost <strong>partajat</strong>", diff --git a/apps/files_sharing/l10n/ro.json b/apps/files_sharing/l10n/ro.json index 042d7324d47..2fa1f4a049e 100644 --- a/apps/files_sharing/l10n/ro.json +++ b/apps/files_sharing/l10n/ro.json @@ -9,6 +9,8 @@ "Nothing shared with you yet" : "Nimic nu e partajat cu tine încă", "Nothing shared yet" : "Nimic partajat încă", "Cancel" : "Anulare", + "No ownCloud installation (7 or higher) found at {remote}" : "Nu s-a găsit nicio instanță ownCloud (versiunea 7 sau mai mare) la {remote}", + "Invalid ownCloud url" : "URL ownCloud invalid", "Shared by" : "impartite in ", "Sharing" : "Partajare", "A file or folder has been <strong>shared</strong>" : "Un fișier sau director a fost <strong>partajat</strong>", diff --git a/apps/files_sharing/l10n/sl.js b/apps/files_sharing/l10n/sl.js index c181742df7a..0b55cb1240b 100644 --- a/apps/files_sharing/l10n/sl.js +++ b/apps/files_sharing/l10n/sl.js @@ -60,6 +60,7 @@ OC.L10N.register( "You removed the share of %2$s for %1$s" : "Odstranili ste mapo v souporabi %2$s za %1$s", "You shared %1$s with group %2$s" : "Omogočili ste souporabo %1$s s skupino %2$s", "You shared %1$s via link" : "Omogočili ste souporabo %1$s preko povezave", + "Your public link for %1$s expired" : "Javna povezava za %1$s je časovno potekla!", "%2$s shared %1$s with you" : "Uporabnik %2$s je omogočil souporabo %1$s", "Downloaded via public link" : "Prejeto preko javne povezave", "Shared with %2$s" : "V souporabi z %2$s", diff --git a/apps/files_sharing/l10n/sl.json b/apps/files_sharing/l10n/sl.json index aab8c565335..947a9d609e5 100644 --- a/apps/files_sharing/l10n/sl.json +++ b/apps/files_sharing/l10n/sl.json @@ -58,6 +58,7 @@ "You removed the share of %2$s for %1$s" : "Odstranili ste mapo v souporabi %2$s za %1$s", "You shared %1$s with group %2$s" : "Omogočili ste souporabo %1$s s skupino %2$s", "You shared %1$s via link" : "Omogočili ste souporabo %1$s preko povezave", + "Your public link for %1$s expired" : "Javna povezava za %1$s je časovno potekla!", "%2$s shared %1$s with you" : "Uporabnik %2$s je omogočil souporabo %1$s", "Downloaded via public link" : "Prejeto preko javne povezave", "Shared with %2$s" : "V souporabi z %2$s", diff --git a/apps/files_sharing/l10n/zh_CN.js b/apps/files_sharing/l10n/zh_CN.js index a9f676fad98..f0f659d1bc6 100644 --- a/apps/files_sharing/l10n/zh_CN.js +++ b/apps/files_sharing/l10n/zh_CN.js @@ -2,15 +2,41 @@ OC.L10N.register( "files_sharing", { "Server to server sharing is not enabled on this server" : "此服务器未启用服务器到服务器分享功能", + "The mountpoint name contains invalid characters." : "挂载点的名称包含无效字符。", + "Not allowed to create a federated share with the same user server" : "不允许使用相同的用户服务器创建联合共享", "Invalid or untrusted SSL certificate" : "无效或是不被信任的 SSL 证书", + "Could not authenticate to remote share, password might be wrong" : "无法验证远程共享,可能是密码错误", + "Storage not valid" : "存储无效", "Couldn't add remote share" : "无法添加远程分享", + "Share API is disabled" : "共享 API 已被禁用", + "Wrong share ID, share doesn't exist" : "错误的共享 ID,共享不存在", + "Could not delete share" : "不能删除共享", + "Please specify a file or folder path" : "请指定一个文件或文件夹路径", + "Wrong path, file/folder doesn't exist" : "路径错误,文件/文件夹不存在", + "Please specify a valid user" : "请指定一个有效的用户", + "Group sharing is disabled by the administrator" : "群组共享已被管理员禁用", + "Please specify a valid group" : "请指定一个有效的组", + "Public link sharing is disabled by the administrator" : "公共链接共享已被管理员禁用", + "Public upload disabled by the administrator" : "公共上传已被管理员禁用", + "Public upload is only possible for publicly shared folders" : "公共上传仅适用于公共共享文件夹", + "Invalid date, date format must be YYYY-MM-DD" : "无效的日期,日期格式必须是 YYYY-MM-DD", + "Sharing %s failed because the back end does not allow shares from type %s" : "共享 %s 失败,后端不允许共享 %s 类型", + "Unknown share type" : "未知共享类型", + "Not a directory" : "不是一个目录", + "Could not lock path" : "无法锁定路径", + "Can't change permissions for public share links" : "不能改变公共分享链接权限", + "Wrong or no update parameter given" : "错误或没有更新参数给出", + "Cannot increase permissions" : "不能增加权限", "Shared with you" : "分享给您的文件", "Shared with others" : "您分享的文件", "Shared by link" : "分享链接的文件", "Federated sharing" : "联合云共享", "Nothing shared with you yet" : "你还没有收到任何共享的文件", + "Files and folders others share with you will show up here" : "其它人共享给您的文件和文件夹将显示在这里", "Nothing shared yet" : "还没有共享过文件", + "Files and folders you share will show up here" : "您共享的文件和文件夹将显示在这里", "No shared links" : "无分享链接", + "Files and folders you share by link will show up here" : "您通过链接共享的文件和文件夹将显示在这里", "Do you want to add the remote share {name} from {owner}@{remote}?" : "您要添加 {name} 来自 {owner}@{remote} 的远程分享吗?", "Remote share" : "远程分享", "Remote share password" : "远程分享密码", @@ -22,21 +48,40 @@ OC.L10N.register( "Shared by" : "共享人", "Sharing" : "共享", "A file or folder has been <strong>shared</strong>" : "一个文件或文件夹已<strong>共享</strong>。", + "A file or folder was shared from <strong>another server</strong>" : "<strong>其它服务器</strong> 中一个文件或者文件夹被共享 ", + "A public shared file or folder was <strong>downloaded</strong>" : "一个公共共享的文件或文件夹<strong>已下载</strong>", + "You received a new remote share %2$s from %1$s" : "您收到一个新的远程共享 %2$s 来自于 %1$s", "You received a new remote share from %s" : "您从%s收到了新的远程分享", "%1$s accepted remote share %2$s" : "%1$s 接受了远程分享 %2$s", "%1$s declined remote share %2$s" : "%1$s 拒绝了远程分享 %2$s", + "%1$s unshared %2$s from you" : "%1$s 未共享你的 %2$s ", "Public shared folder %1$s was downloaded" : "公共共享文件夹 %1$s 已被下载", "Public shared file %1$s was downloaded" : "公共共享文件 %1$s 已被下载", "You shared %1$s with %2$s" : "您把 %1$s分享给了 %2$s", + "%2$s shared %1$s with %3$s" : "%2$s 共享 %1$s 给 %3$s", + "You removed the share of %2$s for %1$s" : "你移除了 %2$s 的共享 %1$s", + "%2$s removed the share of %3$s for %1$s" : "%2$s 移除了 %3$s 的共享 %1$s", "You shared %1$s with group %2$s" : "你把 %1$s 分享给了 %2$s 组", + "%2$s shared %1$s with group %3$s" : "%2$s 共享 %1$s 给群组 %3$s", + "You removed the share of group %2$s for %1$s" : "你移除了组 %2$s 的共享 %1$s", + "%2$s removed the share of group %3$s for %1$s" : "%2$s 移除了组 %3$s 的共享 %1$s", "%2$s shared %1$s via link" : "%2$s 以链接方式共享 %1$s", "You shared %1$s via link" : "您通过链接共享了 %1$s", + "You removed the public link for %1$s" : "你移除了公共链接 %1$s", + "%2$s removed the public link for %1$s" : "%2$s 移除了公共链接 %1$s", + "Your public link for %1$s expired" : "你的公开链接 %1$s 已过期", + "The public link of %2$s for %1$s expired" : "%2$s 的公开链接 %1$s 已过期", "%2$s shared %1$s with you" : "%2$s 把 %1$s 分享给了您", + "%2$s removed the share for %1$s" : "%2$s 移除了共享 %1$s", "Downloaded via public link" : "通过公开链接下载", "Shared with %2$s" : "共享给 %2$s", "Shared with %3$s by %2$s" : "由 %2$s 共享给 %3$s", + "Removed share for %2$s" : "移除共享 %2$s", + "%2$s removed share for %3$s" : "%2$s 移除共享 %3$s", "Shared with group %2$s" : "共享给组%2$s", "Shared with group %3$s by %2$s" : "由 %2$s 共享给组 %3$s", + "Removed share of group %2$s" : "移除了组 %2$s 的共享", + "%2$s removed share of group %3$s" : "%2$s 移除了群 %3$s 的共享", "Shared via link by %2$s" : "%2$s 以链接方式共享", "Shared via public link" : "通过公开链接共享", "Removed public link" : "移除公开链接", diff --git a/apps/files_sharing/l10n/zh_CN.json b/apps/files_sharing/l10n/zh_CN.json index bffaa9b6b5b..e1ba3104700 100644 --- a/apps/files_sharing/l10n/zh_CN.json +++ b/apps/files_sharing/l10n/zh_CN.json @@ -1,14 +1,40 @@ { "translations": { "Server to server sharing is not enabled on this server" : "此服务器未启用服务器到服务器分享功能", + "The mountpoint name contains invalid characters." : "挂载点的名称包含无效字符。", + "Not allowed to create a federated share with the same user server" : "不允许使用相同的用户服务器创建联合共享", "Invalid or untrusted SSL certificate" : "无效或是不被信任的 SSL 证书", + "Could not authenticate to remote share, password might be wrong" : "无法验证远程共享,可能是密码错误", + "Storage not valid" : "存储无效", "Couldn't add remote share" : "无法添加远程分享", + "Share API is disabled" : "共享 API 已被禁用", + "Wrong share ID, share doesn't exist" : "错误的共享 ID,共享不存在", + "Could not delete share" : "不能删除共享", + "Please specify a file or folder path" : "请指定一个文件或文件夹路径", + "Wrong path, file/folder doesn't exist" : "路径错误,文件/文件夹不存在", + "Please specify a valid user" : "请指定一个有效的用户", + "Group sharing is disabled by the administrator" : "群组共享已被管理员禁用", + "Please specify a valid group" : "请指定一个有效的组", + "Public link sharing is disabled by the administrator" : "公共链接共享已被管理员禁用", + "Public upload disabled by the administrator" : "公共上传已被管理员禁用", + "Public upload is only possible for publicly shared folders" : "公共上传仅适用于公共共享文件夹", + "Invalid date, date format must be YYYY-MM-DD" : "无效的日期,日期格式必须是 YYYY-MM-DD", + "Sharing %s failed because the back end does not allow shares from type %s" : "共享 %s 失败,后端不允许共享 %s 类型", + "Unknown share type" : "未知共享类型", + "Not a directory" : "不是一个目录", + "Could not lock path" : "无法锁定路径", + "Can't change permissions for public share links" : "不能改变公共分享链接权限", + "Wrong or no update parameter given" : "错误或没有更新参数给出", + "Cannot increase permissions" : "不能增加权限", "Shared with you" : "分享给您的文件", "Shared with others" : "您分享的文件", "Shared by link" : "分享链接的文件", "Federated sharing" : "联合云共享", "Nothing shared with you yet" : "你还没有收到任何共享的文件", + "Files and folders others share with you will show up here" : "其它人共享给您的文件和文件夹将显示在这里", "Nothing shared yet" : "还没有共享过文件", + "Files and folders you share will show up here" : "您共享的文件和文件夹将显示在这里", "No shared links" : "无分享链接", + "Files and folders you share by link will show up here" : "您通过链接共享的文件和文件夹将显示在这里", "Do you want to add the remote share {name} from {owner}@{remote}?" : "您要添加 {name} 来自 {owner}@{remote} 的远程分享吗?", "Remote share" : "远程分享", "Remote share password" : "远程分享密码", @@ -20,21 +46,40 @@ "Shared by" : "共享人", "Sharing" : "共享", "A file or folder has been <strong>shared</strong>" : "一个文件或文件夹已<strong>共享</strong>。", + "A file or folder was shared from <strong>another server</strong>" : "<strong>其它服务器</strong> 中一个文件或者文件夹被共享 ", + "A public shared file or folder was <strong>downloaded</strong>" : "一个公共共享的文件或文件夹<strong>已下载</strong>", + "You received a new remote share %2$s from %1$s" : "您收到一个新的远程共享 %2$s 来自于 %1$s", "You received a new remote share from %s" : "您从%s收到了新的远程分享", "%1$s accepted remote share %2$s" : "%1$s 接受了远程分享 %2$s", "%1$s declined remote share %2$s" : "%1$s 拒绝了远程分享 %2$s", + "%1$s unshared %2$s from you" : "%1$s 未共享你的 %2$s ", "Public shared folder %1$s was downloaded" : "公共共享文件夹 %1$s 已被下载", "Public shared file %1$s was downloaded" : "公共共享文件 %1$s 已被下载", "You shared %1$s with %2$s" : "您把 %1$s分享给了 %2$s", + "%2$s shared %1$s with %3$s" : "%2$s 共享 %1$s 给 %3$s", + "You removed the share of %2$s for %1$s" : "你移除了 %2$s 的共享 %1$s", + "%2$s removed the share of %3$s for %1$s" : "%2$s 移除了 %3$s 的共享 %1$s", "You shared %1$s with group %2$s" : "你把 %1$s 分享给了 %2$s 组", + "%2$s shared %1$s with group %3$s" : "%2$s 共享 %1$s 给群组 %3$s", + "You removed the share of group %2$s for %1$s" : "你移除了组 %2$s 的共享 %1$s", + "%2$s removed the share of group %3$s for %1$s" : "%2$s 移除了组 %3$s 的共享 %1$s", "%2$s shared %1$s via link" : "%2$s 以链接方式共享 %1$s", "You shared %1$s via link" : "您通过链接共享了 %1$s", + "You removed the public link for %1$s" : "你移除了公共链接 %1$s", + "%2$s removed the public link for %1$s" : "%2$s 移除了公共链接 %1$s", + "Your public link for %1$s expired" : "你的公开链接 %1$s 已过期", + "The public link of %2$s for %1$s expired" : "%2$s 的公开链接 %1$s 已过期", "%2$s shared %1$s with you" : "%2$s 把 %1$s 分享给了您", + "%2$s removed the share for %1$s" : "%2$s 移除了共享 %1$s", "Downloaded via public link" : "通过公开链接下载", "Shared with %2$s" : "共享给 %2$s", "Shared with %3$s by %2$s" : "由 %2$s 共享给 %3$s", + "Removed share for %2$s" : "移除共享 %2$s", + "%2$s removed share for %3$s" : "%2$s 移除共享 %3$s", "Shared with group %2$s" : "共享给组%2$s", "Shared with group %3$s by %2$s" : "由 %2$s 共享给组 %3$s", + "Removed share of group %2$s" : "移除了组 %2$s 的共享", + "%2$s removed share of group %3$s" : "%2$s 移除了群 %3$s 的共享", "Shared via link by %2$s" : "%2$s 以链接方式共享", "Shared via public link" : "通过公开链接共享", "Removed public link" : "移除公开链接", diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php index de7e7dd7b0c..04912d20afc 100644 --- a/apps/files_sharing/lib/controllers/sharecontroller.php +++ b/apps/files_sharing/lib/controllers/sharecontroller.php @@ -486,16 +486,25 @@ class ShareController extends Controller { $this->emitAccessShareHook($share); + $server_params = array( 'head' => $this->request->getMethod() == 'HEAD' ); + + /** + * Http range requests support + */ + if (isset($_SERVER['HTTP_RANGE'])) { + $server_params['range'] = $this->request->getHeader('Range'); + } + // download selected files if (!is_null($files) && $files !== '') { // FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well // after dispatching the request which results in a "Cannot modify header information" notice. - OC_Files::get($originalSharePath, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD'); + OC_Files::get($originalSharePath, $files_list, $server_params); exit(); } else { // FIXME: The exit is required here because otherwise the AppFramework is trying to add headers as well // after dispatching the request which results in a "Cannot modify header information" notice. - OC_Files::get(dirname($originalSharePath), basename($originalSharePath), $_SERVER['REQUEST_METHOD'] == 'HEAD'); + OC_Files::get(dirname($originalSharePath), basename($originalSharePath), $server_params); exit(); } } diff --git a/apps/files_sharing/lib/external/manager.php b/apps/files_sharing/lib/external/manager.php index 7dc9f66f114..5b7a13f1eb1 100644 --- a/apps/files_sharing/lib/external/manager.php +++ b/apps/files_sharing/lib/external/manager.php @@ -325,6 +325,10 @@ class Manager { } public function removeShare($mountPoint) { + + $mountPointObj = $this->mountManager->find($mountPoint); + $id = $mountPointObj->getStorage()->getCache()->getId(); + $mountPoint = $this->stripPath($mountPoint); $hash = md5($mountPoint); @@ -338,13 +342,43 @@ class Manager { $share = $getShare->fetch(); $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); } + $getShare->closeCursor(); $query = $this->connection->prepare(' DELETE FROM `*PREFIX*share_external` WHERE `mountpoint_hash` = ? AND `user` = ? '); - return (bool)$query->execute(array($hash, $this->uid)); + $result = (bool)$query->execute(array($hash, $this->uid)); + + if($result) { + $this->removeReShares($id); + } + + return $result; + } + + /** + * remove re-shares from share table and mapping in the federated_reshares table + * + * @param $mountPointId + */ + protected function removeReShares($mountPointId) { + $selectQuery = $this->connection->getQueryBuilder(); + $query = $this->connection->getQueryBuilder(); + $selectQuery->select('id')->from('share') + ->where($selectQuery->expr()->eq('file_source', $query->createNamedParameter($mountPointId))); + $select = $selectQuery->getSQL(); + + + $query->delete('federated_reshares') + ->where($query->expr()->in('share_id', $query->createFunction('(' . $select . ')'))); + $query->execute(); + + $deleteReShares = $this->connection->getQueryBuilder(); + $deleteReShares->delete('share') + ->where($deleteReShares->expr()->eq('file_source', $deleteReShares->createNamedParameter($mountPointId))); + $deleteReShares->execute(); } /** diff --git a/apps/files_sharing/lib/notifier.php b/apps/files_sharing/lib/notifier.php deleted file mode 100644 index 27e4e2565f2..00000000000 --- a/apps/files_sharing/lib/notifier.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php -/** - * @author Joas Schilling <nickvergessen@owncloud.com> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * 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/> - * - */ - -namespace OCA\Files_Sharing; - - -use OCP\Notification\INotification; -use OCP\Notification\INotifier; - -class Notifier implements INotifier { - /** @var \OCP\L10N\IFactory */ - protected $factory; - - /** - * @param \OCP\L10N\IFactory $factory - */ - public function __construct(\OCP\L10N\IFactory $factory) { - $this->factory = $factory; - } - - /** - * @param INotification $notification - * @param string $languageCode The code of the language that should be used to prepare the notification - * @return INotification - */ - public function prepare(INotification $notification, $languageCode) { - if ($notification->getApp() !== 'files_sharing') { - // Not my app => throw - throw new \InvalidArgumentException(); - } - - // Read the language from the notification - $l = $this->factory->get('files_sharing', $languageCode); - - switch ($notification->getSubject()) { - // Deal with known subjects - case 'remote_share': - $params = $notification->getSubjectParameters(); - $notification->setParsedSubject( - (string) $l->t('You received "/%2$s" as a remote share from %1$s', $params) - ); - - // Deal with the actions for a known subject - foreach ($notification->getActions() as $action) { - switch ($action->getLabel()) { - case 'accept': - $action->setParsedLabel( - (string) $l->t('Accept') - ) - ->setPrimary(true); - break; - - case 'decline': - $action->setParsedLabel( - (string) $l->t('Decline') - ); - break; - } - - $notification->addParsedAction($action); - } - return $notification; - - default: - // Unknown subject => Unknown notification => throw - throw new \InvalidArgumentException(); - } - } -} diff --git a/apps/files_sharing/tests/api/share20ocstest.php b/apps/files_sharing/tests/api/share20ocstest.php index ffb74da2af7..96ce34f963c 100644 --- a/apps/files_sharing/tests/api/share20ocstest.php +++ b/apps/files_sharing/tests/api/share20ocstest.php @@ -82,6 +82,8 @@ class Share20OCSTest extends \Test\TestCase { $this->currentUser = $this->getMock('OCP\IUser'); $this->currentUser->method('getUID')->willReturn('currentUser'); + $this->userManager->expects($this->any())->method('userExists')->willReturn(true); + $this->l = $this->getMock('\OCP\IL10N'); $this->l->method('t') ->will($this->returnCallback(function($text, $parameters = []) { diff --git a/apps/files_sharing/tests/deleteorphanedsharesjobtest.php b/apps/files_sharing/tests/deleteorphanedsharesjobtest.php index 353520bd604..c9aea60d255 100644 --- a/apps/files_sharing/tests/deleteorphanedsharesjobtest.php +++ b/apps/files_sharing/tests/deleteorphanedsharesjobtest.php @@ -154,7 +154,7 @@ class DeleteOrphanedSharesJobTest extends \Test\TestCase { public function testKeepNonFileShares() { $this->loginAsUser($this->user1); - \OCP\Share::registerBackend('test', 'Test_Share_Backend'); + \OCP\Share::registerBackend('test', 'Test\Share\Backend'); $this->assertTrue( \OCP\Share::shareItem('test', 'test.txt', \OCP\Share::SHARE_TYPE_USER, $this->user2, \OCP\Constants::PERMISSION_READ), diff --git a/apps/files_sharing/tests/server2server.php b/apps/files_sharing/tests/server2server.php deleted file mode 100644 index 1d047916ca9..00000000000 --- a/apps/files_sharing/tests/server2server.php +++ /dev/null @@ -1,263 +0,0 @@ -<?php -/** - * @author Björn Schießle <schiessle@owncloud.com> - * @author Joas Schilling <nickvergessen@owncloud.com> - * @author Lukas Reschke <lukas@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * 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 OCA\Files_Sharing\Tests\TestCase; - -/** - * Class Test_Files_Sharing_Api - * - * @group DB - */ -class Test_Files_Sharing_S2S_OCS_API extends TestCase { - - const TEST_FOLDER_NAME = '/folder_share_api_test'; - - /** - * @var \OCP\IDBConnection - */ - private $connection; - - /** - * @var \OCA\Files_Sharing\API\Server2Server - */ - private $s2s; - - /** @var \OCA\FederatedFileSharing\FederatedShareProvider | PHPUnit_Framework_MockObject_MockObject */ - private $federatedShareProvider; - - protected function setUp() { - parent::setUp(); - - self::loginHelper(self::TEST_FILES_SHARING_API_USER1); - \OCP\Share::registerBackend('test', 'Test_Share_Backend'); - - $config = $this->getMockBuilder('\OCP\IConfig') - ->disableOriginalConstructor()->getMock(); - $clientService = $this->getMock('\OCP\Http\Client\IClientService'); - $httpHelperMock = $this->getMockBuilder('\OC\HTTPHelper') - ->setConstructorArgs([$config, $clientService]) - ->getMock(); - $httpHelperMock->expects($this->any())->method('post')->with($this->anything())->will($this->returnValue(true)); - $this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider') - ->disableOriginalConstructor()->getMock(); - $this->federatedShareProvider->expects($this->any()) - ->method('isOutgoingServer2serverShareEnabled')->willReturn(true); - $this->federatedShareProvider->expects($this->any()) - ->method('isIncomingServer2serverShareEnabled')->willReturn(true); - - $this->registerHttpHelper($httpHelperMock); - - $this->s2s = new \OCA\Files_Sharing\API\Server2Server($this->federatedShareProvider); - - $this->connection = \OC::$server->getDatabaseConnection(); - } - - protected function tearDown() { - $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share_external`'); - $query->execute(); - - $this->restoreHttpHelper(); - - parent::tearDown(); - } - - /** - * Register an http helper mock for testing purposes. - * @param $httpHelper http helper mock - */ - private function registerHttpHelper($httpHelper) { - $this->oldHttpHelper = \OC::$server->query('HTTPHelper'); - \OC::$server->registerService('HTTPHelper', function ($c) use ($httpHelper) { - return $httpHelper; - }); - } - - /** - * Restore the original http helper - */ - private function restoreHttpHelper() { - $oldHttpHelper = $this->oldHttpHelper; - \OC::$server->registerService('HTTPHelper', function ($c) use ($oldHttpHelper) { - return $oldHttpHelper; - }); - } - - /** - * @medium - */ - function testCreateShare() { - // simulate a post request - $_POST['remote'] = 'localhost'; - $_POST['token'] = 'token'; - $_POST['name'] = 'name'; - $_POST['owner'] = 'owner'; - $_POST['shareWith'] = self::TEST_FILES_SHARING_API_USER2; - $_POST['remoteId'] = 1; - - $result = $this->s2s->createShare(null); - - $this->assertTrue($result->succeeded()); - - $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share_external` WHERE `remote_id` = ?'); - $result = $query->execute(array('1')); - $data = $result->fetchRow(); - - $this->assertSame('localhost', $data['remote']); - $this->assertSame('token', $data['share_token']); - $this->assertSame('/name', $data['name']); - $this->assertSame('owner', $data['owner']); - $this->assertSame(self::TEST_FILES_SHARING_API_USER2, $data['user']); - $this->assertSame(1, (int)$data['remote_id']); - $this->assertSame(0, (int)$data['accepted']); - } - - - function testDeclineShare() { - $dummy = \OCP\DB::prepare(' - INSERT INTO `*PREFIX*share` - (`share_type`, `uid_owner`, `item_type`, `item_source`, `item_target`, `file_source`, `file_target`, `permissions`, `stime`, `token`, `share_with`) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) - '); - $dummy->execute(array(\OCP\Share::SHARE_TYPE_REMOTE, self::TEST_FILES_SHARING_API_USER1, 'test', '1', '/1', '1', '/test.txt', '1', time(), 'token', 'foo@bar')); - - $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); - $result = $verify->execute(); - $data = $result->fetchAll(); - $this->assertSame(1, count($data)); - - $_POST['token'] = 'token'; - $this->s2s->declineShare(array('id' => $data[0]['id'])); - - $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); - $result = $verify->execute(); - $data = $result->fetchAll(); - $this->assertEmpty($data); - } - - function testDeclineShareMultiple() { - $dummy = \OCP\DB::prepare(' - INSERT INTO `*PREFIX*share` - (`share_type`, `uid_owner`, `item_type`, `item_source`, `item_target`, `file_source`, `file_target`, `permissions`, `stime`, `token`, `share_with`) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) - '); - $dummy->execute(array(\OCP\Share::SHARE_TYPE_REMOTE, self::TEST_FILES_SHARING_API_USER1, 'test', '1', '/1', '1', '/test.txt', '1', time(), 'token1', 'foo@bar')); - $dummy->execute(array(\OCP\Share::SHARE_TYPE_REMOTE, self::TEST_FILES_SHARING_API_USER1, 'test', '1', '/1', '1', '/test.txt', '1', time(), 'token2', 'bar@bar')); - - $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); - $result = $verify->execute(); - $data = $result->fetchAll(); - $this->assertCount(2, $data); - - $_POST['token'] = 'token1'; - $this->s2s->declineShare(array('id' => $data[0]['id'])); - - $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); - $result = $verify->execute(); - $data = $result->fetchAll(); - $this->assertCount(1, $data); - $this->assertEquals('bar@bar', $data[0]['share_with']); - - $_POST['token'] = 'token2'; - $this->s2s->declineShare(array('id' => $data[0]['id'])); - - $verify = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share`'); - $result = $verify->execute(); - $data = $result->fetchAll(); - $this->assertEmpty($data); - } - - /** - * @dataProvider dataTestDeleteUser - */ - function testDeleteUser($toDelete, $expected, $remainingUsers) { - $this->createDummyS2SShares(); - - $discoveryManager = new \OCA\FederatedFileSharing\DiscoveryManager( - \OC::$server->getMemCacheFactory(), - \OC::$server->getHTTPClientService() - ); - $manager = new OCA\Files_Sharing\External\Manager( - \OC::$server->getDatabaseConnection(), - \OC\Files\Filesystem::getMountManager(), - \OC\Files\Filesystem::getLoader(), - \OC::$server->getHTTPHelper(), - \OC::$server->getNotificationManager(), - $discoveryManager, - $toDelete - ); - - $manager->removeUserShares($toDelete); - - $query = $this->connection->prepare('SELECT `user` FROM `*PREFIX*share_external`'); - $query->execute(); - $result = $query->fetchAll(); - - foreach ($result as $r) { - $remainingShares[$r['user']] = isset($remainingShares[$r['user']]) ? $remainingShares[$r['user']] + 1 : 1; - } - - $this->assertSame($remainingUsers, count($remainingShares)); - - foreach ($expected as $key => $value) { - if ($key === $toDelete) { - $this->assertArrayNotHasKey($key, $remainingShares); - } else { - $this->assertSame($value, $remainingShares[$key]); - } - } - - } - - function dataTestDeleteUser() { - return array( - array('user1', array('user1' => 0, 'user2' => 3, 'user3' => 3), 2), - array('user2', array('user1' => 4, 'user2' => 0, 'user3' => 3), 2), - array('user3', array('user1' => 4, 'user2' => 3, 'user3' => 0), 2), - array('user4', array('user1' => 4, 'user2' => 3, 'user3' => 3), 3), - ); - } - - private function createDummyS2SShares() { - $query = $this->connection->prepare(' - INSERT INTO `*PREFIX*share_external` - (`remote`, `share_token`, `password`, `name`, `owner`, `user`, `mountpoint`, `mountpoint_hash`, `remote_id`, `accepted`) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) - '); - - $users = array('user1', 'user2', 'user3'); - - for ($i = 0; $i < 10; $i++) { - $user = $users[$i%3]; - $query->execute(array('remote', 'token', 'password', 'name', 'owner', $user, 'mount point', $i, $i, 0)); - } - - $query = $this->connection->prepare('SELECT `id` FROM `*PREFIX*share_external`'); - $query->execute(); - $dummyEntries = $query->fetchAll(); - - $this->assertSame(10, count($dummyEntries)); - } - -} diff --git a/apps/files_sharing/tests/testcase.php b/apps/files_sharing/tests/testcase.php index 0950c2a62f5..b1d6facafd6 100644 --- a/apps/files_sharing/tests/testcase.php +++ b/apps/files_sharing/tests/testcase.php @@ -143,7 +143,7 @@ abstract class TestCase extends \Test\TestCase { \OC_User::clearBackends(); \OC_User::useBackend('database'); \OC_Group::clearBackends(); - \OC_Group::useBackend(new \OC_Group_Database()); + \OC_Group::useBackend(new \OC\Group\Database()); parent::tearDownAfterClass(); } |