diff options
Diffstat (limited to 'apps/files_sharing')
40 files changed, 421 insertions, 114 deletions
diff --git a/apps/files_sharing/ajax/external.php b/apps/files_sharing/ajax/external.php index 0f8a3d56cf0..2ba1cb470c2 100644 --- a/apps/files_sharing/ajax/external.php +++ b/apps/files_sharing/ajax/external.php @@ -40,6 +40,7 @@ if (OCA\Files_Sharing\Helper::isIncomingServer2serverShareEnabled() === false) { $token = $_POST['token']; $remote = $_POST['remote']; $owner = $_POST['owner']; +$ownerDisplayName = $_POST['ownerDisplayName']; $name = $_POST['name']; $password = $_POST['password']; @@ -49,6 +50,14 @@ if(!\OCP\Util::isValidFileName($name)) { exit(); } +$currentUser = \OC::$server->getUserSession()->getUser()->getUID(); +$currentServer = \OC::$server->getURLGenerator()->getAbsoluteURL('/'); +if (\OC\Share\Helper::isSameUserOnSameServer($owner, $remote, $currentUser, $currentServer )) { + \OCP\JSON::error(array('data' => array('message' => $l->t('Not allowed to create a federated share with the same user server')))); + exit(); +} + + $externalManager = new \OCA\Files_Sharing\External\Manager( \OC::$server->getDatabaseConnection(), \OC\Files\Filesystem::getMountManager(), @@ -68,7 +77,7 @@ if (substr($remote, 0, 5) === 'https') { } } -$mount = $externalManager->addShare($remote, $token, $password, $name, $owner, true); +$mount = $externalManager->addShare($remote, $token, $password, $name, $ownerDisplayName, true); /** * @var \OCA\Files_Sharing\External\Storage $storage diff --git a/apps/files_sharing/api/local.php b/apps/files_sharing/api/local.php index aaafafb269f..5b2f2e06e75 100644 --- a/apps/files_sharing/api/local.php +++ b/apps/files_sharing/api/local.php @@ -64,9 +64,10 @@ class Local { if ($shares === false) { return new \OC_OCS_Result(null, 404, 'could not get shares'); } else { + $mimetypeDetector = \OC::$server->getMimeTypeDetector(); foreach ($shares as &$share) { if ($share['item_type'] === 'file' && isset($share['path'])) { - $share['mimetype'] = \OC_Helper::getFileNameMimeType($share['path']); + $share['mimetype'] = $mimetypeDetector->detectPath($share['path']); if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) { $share['isPreviewAvailable'] = true; } @@ -227,9 +228,10 @@ class Local { private static function getFilesSharedWithMe() { try { $shares = \OCP\Share::getItemsSharedWith('file'); + $mimetypeDetector = \OC::$server->getMimeTypeDetector(); foreach ($shares as &$share) { if ($share['item_type'] === 'file') { - $share['mimetype'] = \OC_Helper::getFileNameMimeType($share['file_target']); + $share['mimetype'] = $mimetypeDetector->detectPath($share['file_target']); if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) { $share['isPreviewAvailable'] = true; } diff --git a/apps/files_sharing/js/external.js b/apps/files_sharing/js/external.js index f658de307ab..45a6ef02758 100644 --- a/apps/files_sharing/js/external.js +++ b/apps/files_sharing/js/external.js @@ -19,7 +19,7 @@ */ OCA.Sharing.showAddExternalDialog = function (share, passwordProtected, callback) { var remote = share.remote; - var owner = share.owner; + var owner = share.ownerDisplayName || share.owner; var name = share.name; var remoteClean = (remote.substr(0, 8) === 'https://') ? remote.substr(8) : remote.substr(7); @@ -92,6 +92,7 @@ remote: share.remote, token: share.token, owner: share.owner, + ownerDisplayName: share.ownerDisplayName || share.owner, name: share.name, password: password}, function(result) { if (result.status === 'error') { diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 70c1ba5c0c2..af808447381 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -242,9 +242,10 @@ OCA.Sharing.PublicApp = { var remote = $(this).find('input[type="text"]').val(); var token = $('#sharingToken').val(); var owner = $('#save').data('owner'); + var ownerDisplayName = $('#save').data('owner-display-name'); var name = $('#save').data('name'); var isProtected = $('#save').data('protected') ? 1 : 0; - OCA.Sharing.PublicApp._saveToOwnCloud(remote, token, owner, name, isProtected); + OCA.Sharing.PublicApp._saveToOwnCloud(remote, token, owner, ownerDisplayName, name, isProtected); }); $('#remote_address').on("keyup paste", function() { @@ -291,7 +292,7 @@ OCA.Sharing.PublicApp = { this.fileList.changeDirectory(params.path || params.dir, false, true); }, - _saveToOwnCloud: function (remote, token, owner, name, isProtected) { + _saveToOwnCloud: function (remote, token, owner, ownerDisplayName, name, isProtected) { var location = window.location.protocol + '//' + window.location.host + OC.webroot; if(remote.substr(-1) !== '/') { @@ -299,7 +300,7 @@ OCA.Sharing.PublicApp = { }; var url = remote + 'index.php/apps/files#' + 'remote=' + encodeURIComponent(location) // our location is the remote for the other server - + "&token=" + encodeURIComponent(token) + "&owner=" + encodeURIComponent(owner) + "&name=" + encodeURIComponent(name) + "&protected=" + isProtected; + + "&token=" + encodeURIComponent(token) + "&owner=" + encodeURIComponent(owner) +"&ownerDisplayName=" + encodeURIComponent(ownerDisplayName) + "&name=" + encodeURIComponent(name) + "&protected=" + isProtected; if (remote.indexOf('://') > 0) { diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 3d105f283d8..f8d89828f4d 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -45,6 +45,9 @@ if (fileData.type === 'file') { // files can't be shared with delete permissions sharePermissions = sharePermissions & ~OC.PERMISSION_DELETE; + + // create permissions don't mean anything for files + sharePermissions = sharePermissions & ~OC.PERMISSION_CREATE; } tr.attr('data-share-permissions', sharePermissions); if (fileData.shareOwner) { diff --git a/apps/files_sharing/l10n/es.js b/apps/files_sharing/l10n/es.js index 650fb5c524a..e77c4b974f7 100644 --- a/apps/files_sharing/l10n/es.js +++ b/apps/files_sharing/l10n/es.js @@ -52,6 +52,7 @@ OC.L10N.register( "Shared by %2$s" : "Compartido por %2$s", "Shared via public link" : "Compartido vía enlace público", "Shares" : "Compartidos", + "You received %2$s as a remote share from %1$s" : "Ha recibido %2$s como un recurso compartido de %1$s", "Accept" : "Aceptar", "Decline" : "Denegar", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Compartirlo conmigo a través de mi ID Nube Federada #ownCloud, ver %s", diff --git a/apps/files_sharing/l10n/es.json b/apps/files_sharing/l10n/es.json index 6f963ab8fee..96fb368f76b 100644 --- a/apps/files_sharing/l10n/es.json +++ b/apps/files_sharing/l10n/es.json @@ -50,6 +50,7 @@ "Shared by %2$s" : "Compartido por %2$s", "Shared via public link" : "Compartido vía enlace público", "Shares" : "Compartidos", + "You received %2$s as a remote share from %1$s" : "Ha recibido %2$s como un recurso compartido de %1$s", "Accept" : "Aceptar", "Decline" : "Denegar", "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Compartirlo conmigo a través de mi ID Nube Federada #ownCloud, ver %s", diff --git a/apps/files_sharing/l10n/et_EE.js b/apps/files_sharing/l10n/et_EE.js index 6d02bdd6ced..2fcce251407 100644 --- a/apps/files_sharing/l10n/et_EE.js +++ b/apps/files_sharing/l10n/et_EE.js @@ -30,6 +30,8 @@ OC.L10N.register( "You shared %1$s with group %2$s" : "Jagasid %1$s %2$s grupiga", "%2$s shared %1$s with you" : "%2$s jagas sinuga %1$s", "You shared %1$s via link" : "Jagasid %1$s lingiga", + "Downloaded via public link" : "Alla laetud avalikult lingilt", + "Shared with %2$s" : "Jagatud kasutajaga %2$s", "Shares" : "Jagamised", "Accept" : "Nõustu", "Decline" : "Lükka tagasi", diff --git a/apps/files_sharing/l10n/et_EE.json b/apps/files_sharing/l10n/et_EE.json index 481a75210ee..34ddd9f1b15 100644 --- a/apps/files_sharing/l10n/et_EE.json +++ b/apps/files_sharing/l10n/et_EE.json @@ -28,6 +28,8 @@ "You shared %1$s with group %2$s" : "Jagasid %1$s %2$s grupiga", "%2$s shared %1$s with you" : "%2$s jagas sinuga %1$s", "You shared %1$s via link" : "Jagasid %1$s lingiga", + "Downloaded via public link" : "Alla laetud avalikult lingilt", + "Shared with %2$s" : "Jagatud kasutajaga %2$s", "Shares" : "Jagamised", "Accept" : "Nõustu", "Decline" : "Lükka tagasi", diff --git a/apps/files_sharing/l10n/fi_FI.js b/apps/files_sharing/l10n/fi_FI.js index a87d6156d40..accd43020ff 100644 --- a/apps/files_sharing/l10n/fi_FI.js +++ b/apps/files_sharing/l10n/fi_FI.js @@ -3,6 +3,7 @@ OC.L10N.register( { "Server to server sharing is not enabled on this server" : "Palvelimelta-palvelimelle-jakaminen ei ole käytössä tällä palvelimella", "The mountpoint name contains invalid characters." : "Liitospisteen nimi sisältää virheellisiä merkkejä.", + "Not allowed to create a federated share with the same user server" : "Saman käyttäjäpalvelimen kanssa ei ole sallittua luoda federoitua jakoa", "Invalid or untrusted SSL certificate" : "Virheellinen tai ei-luotettu SSL-varmenne", "Could not authenticate to remote share, password might be wrong" : "Tunnistautuminen etäjakoa kohtaan epäonnistui. Salasana saattaa olla väärä", "Storage not valid" : "Tallennustila ei ole kelvollinen", diff --git a/apps/files_sharing/l10n/fi_FI.json b/apps/files_sharing/l10n/fi_FI.json index 172b8476092..e321d64732f 100644 --- a/apps/files_sharing/l10n/fi_FI.json +++ b/apps/files_sharing/l10n/fi_FI.json @@ -1,6 +1,7 @@ { "translations": { "Server to server sharing is not enabled on this server" : "Palvelimelta-palvelimelle-jakaminen ei ole käytössä tällä palvelimella", "The mountpoint name contains invalid characters." : "Liitospisteen nimi sisältää virheellisiä merkkejä.", + "Not allowed to create a federated share with the same user server" : "Saman käyttäjäpalvelimen kanssa ei ole sallittua luoda federoitua jakoa", "Invalid or untrusted SSL certificate" : "Virheellinen tai ei-luotettu SSL-varmenne", "Could not authenticate to remote share, password might be wrong" : "Tunnistautuminen etäjakoa kohtaan epäonnistui. Salasana saattaa olla väärä", "Storage not valid" : "Tallennustila ei ole kelvollinen", diff --git a/apps/files_sharing/l10n/it.js b/apps/files_sharing/l10n/it.js index 8cd66b34d24..39f7ced4bbd 100644 --- a/apps/files_sharing/l10n/it.js +++ b/apps/files_sharing/l10n/it.js @@ -3,6 +3,7 @@ OC.L10N.register( { "Server to server sharing is not enabled on this server" : "La condivisione tra server non è abilitata su questo server", "The mountpoint name contains invalid characters." : "Il nome del punto di mount contiene caratteri non validi.", + "Not allowed to create a federated share with the same user server" : "Non è consentito creare una condivisione federata con lo stesso server dell'utente", "Invalid or untrusted SSL certificate" : "Certificato SSL non valido o non attendibile", "Could not authenticate to remote share, password might be wrong" : "Impossibile autenticarsi sulla condivisione remota, la password potrebbe essere errata", "Storage not valid" : "Archiviazione non valida", diff --git a/apps/files_sharing/l10n/it.json b/apps/files_sharing/l10n/it.json index b93dafd7555..f40fbb4b232 100644 --- a/apps/files_sharing/l10n/it.json +++ b/apps/files_sharing/l10n/it.json @@ -1,6 +1,7 @@ { "translations": { "Server to server sharing is not enabled on this server" : "La condivisione tra server non è abilitata su questo server", "The mountpoint name contains invalid characters." : "Il nome del punto di mount contiene caratteri non validi.", + "Not allowed to create a federated share with the same user server" : "Non è consentito creare una condivisione federata con lo stesso server dell'utente", "Invalid or untrusted SSL certificate" : "Certificato SSL non valido o non attendibile", "Could not authenticate to remote share, password might be wrong" : "Impossibile autenticarsi sulla condivisione remota, la password potrebbe essere errata", "Storage not valid" : "Archiviazione non valida", diff --git a/apps/files_sharing/l10n/ja.js b/apps/files_sharing/l10n/ja.js index e40acc0104a..e3427ea1f7b 100644 --- a/apps/files_sharing/l10n/ja.js +++ b/apps/files_sharing/l10n/ja.js @@ -3,6 +3,7 @@ OC.L10N.register( { "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" : "ストレージが無効です", diff --git a/apps/files_sharing/l10n/ja.json b/apps/files_sharing/l10n/ja.json index 989a723b2a8..9dc64e2b3ec 100644 --- a/apps/files_sharing/l10n/ja.json +++ b/apps/files_sharing/l10n/ja.json @@ -1,6 +1,7 @@ { "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" : "ストレージが無効です", diff --git a/apps/files_sharing/l10n/lt_LT.js b/apps/files_sharing/l10n/lt_LT.js index 93848326605..517cc0915be 100644 --- a/apps/files_sharing/l10n/lt_LT.js +++ b/apps/files_sharing/l10n/lt_LT.js @@ -3,6 +3,7 @@ OC.L10N.register( { "Server to server sharing is not enabled on this server" : "Serveris - serveris dalinimasis neįjungtas šiame serveryje", "The mountpoint name contains invalid characters." : "Prijungimo taškas su neleistinais simboliais.", + "Not allowed to create a federated share with the same user server" : "Neleidžiama dalintis tarp serverių, nes vartotojas tame pačiame serveryje.", "Invalid or untrusted SSL certificate" : "Netinkamas arba nepatikimas SSL sertifikatas", "Could not authenticate to remote share, password might be wrong" : "Nepavyko identifikuotis serveryje, gal netinkamas slaptažodis", "Storage not valid" : "Talpykla negalioja", diff --git a/apps/files_sharing/l10n/lt_LT.json b/apps/files_sharing/l10n/lt_LT.json index 6d777024052..923971c336b 100644 --- a/apps/files_sharing/l10n/lt_LT.json +++ b/apps/files_sharing/l10n/lt_LT.json @@ -1,6 +1,7 @@ { "translations": { "Server to server sharing is not enabled on this server" : "Serveris - serveris dalinimasis neįjungtas šiame serveryje", "The mountpoint name contains invalid characters." : "Prijungimo taškas su neleistinais simboliais.", + "Not allowed to create a federated share with the same user server" : "Neleidžiama dalintis tarp serverių, nes vartotojas tame pačiame serveryje.", "Invalid or untrusted SSL certificate" : "Netinkamas arba nepatikimas SSL sertifikatas", "Could not authenticate to remote share, password might be wrong" : "Nepavyko identifikuotis serveryje, gal netinkamas slaptažodis", "Storage not valid" : "Talpykla negalioja", diff --git a/apps/files_sharing/l10n/mk.js b/apps/files_sharing/l10n/mk.js index a5de7fb5c09..5be22894b99 100644 --- a/apps/files_sharing/l10n/mk.js +++ b/apps/files_sharing/l10n/mk.js @@ -1,20 +1,44 @@ OC.L10N.register( "files_sharing", { + "Server to server sharing is not enabled on this 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" : "Не можам да додадам оддалечено споделување", "Shared with you" : "Споделено со тебе", "Shared with others" : "Сподели со останатите", "Shared by link" : "Споделено со врска", + "Nothing shared with you yet" : "Сеуште ништо не е споделено со вас", + "Nothing shared yet" : "Уште ништо не е споделено", + "No shared links" : "Нема споделени врски/линкови", + "Remote share" : "Оддалечено споделување", + "Remote share password" : "Лозинка за оддалечаното споделување", "Cancel" : "Откажи", + "Add remote share" : "Додади оддалечно споделување", + "You can upload into this folder" : "Можете да прикачите во оваа папка", + "Invalid ownCloud url" : "Неисправен ownCloud url", "Shared by" : "Споделено од", "Sharing" : "Споделување", "A file or folder has been <strong>shared</strong>" : "Датотека или фолдер беше <strong>споделен</strong>", "You shared %1$s with %2$s" : "Вие споделивте %1$s со %2$s", "You shared %1$s with group %2$s" : "Вие споделивте %1$s со групата %2$s", "%2$s shared %1$s with you" : "%2$s споделено %1$s со вас", + "Downloaded via public link" : "Преземи преку јавен линк", + "Shared with %2$s" : "Споделено со %2$s", + "Shared with group %2$s" : "Споделено со група %2$s", + "Shared with %3$s by %2$s" : "Споделено со %3$s од %2$s", + "Shared with group %3$s by %2$s" : "Споделено со група %3$s од %2$s", + "Shared via link by %2$s" : "Споделено со врска/линк од %2$s", + "Shared by %2$s" : "Споделено од %2$s", + "Shared via public link" : "Споделено со јавна врска/линк", "Shares" : "Споделувања", + "Accept" : "Прифати", + "Decline" : "Одбиј", "This share is password-protected" : "Ова споделување е заштитено со лозинка", "The password is wrong. Try again." : "Лозинката е грешна. Обиди се повторно.", "Password" : "Лозинка", + "No entries found in this folder" : "Нема ништо во оваа папка", "Name" : "Име", "Share time" : "Сподели време", "Sorry, this link doesn’t seem to work anymore." : "Извенете, но овој линк изгледа дека повеќе не функционира.", @@ -23,8 +47,17 @@ OC.L10N.register( "the link expired" : "времетраењето на линкот е изминато", "sharing is disabled" : "споделувањето не е дозволено", "For more info, please ask the person who sent this link." : "За повеќе информации, прашајте го лицето кое ви ја испратила врската.", + "Add to your ownCloud" : "Додади во вашиот ownCloud", "Download" : "Преземи", "Download %s" : "Преземи %s", - "Direct link" : "Директна врска" + "Direct link" : "Директна врска", + "Federated Cloud Sharing" : "Федерирано клауд споделување", + "Open documentation" : "Отвори ја документацијата", + "Federated Cloud" : "Федериран клауд", + "Your Federated Cloud ID:" : "Вашиот федериран Cloud ID:", + "Share it:" : "Сподели го:", + "Add to your website" : "Додади на твојот веб сајт", + "Share with me via ownCloud" : "Сподели со мене преку ownCloud", + "HTML Code:" : "HTML код:" }, "nplurals=2; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : 1;"); diff --git a/apps/files_sharing/l10n/mk.json b/apps/files_sharing/l10n/mk.json index ad7eff6078b..40bcf9f8bde 100644 --- a/apps/files_sharing/l10n/mk.json +++ b/apps/files_sharing/l10n/mk.json @@ -1,18 +1,42 @@ { "translations": { + "Server to server sharing is not enabled on this 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" : "Не можам да додадам оддалечено споделување", "Shared with you" : "Споделено со тебе", "Shared with others" : "Сподели со останатите", "Shared by link" : "Споделено со врска", + "Nothing shared with you yet" : "Сеуште ништо не е споделено со вас", + "Nothing shared yet" : "Уште ништо не е споделено", + "No shared links" : "Нема споделени врски/линкови", + "Remote share" : "Оддалечено споделување", + "Remote share password" : "Лозинка за оддалечаното споделување", "Cancel" : "Откажи", + "Add remote share" : "Додади оддалечно споделување", + "You can upload into this folder" : "Можете да прикачите во оваа папка", + "Invalid ownCloud url" : "Неисправен ownCloud url", "Shared by" : "Споделено од", "Sharing" : "Споделување", "A file or folder has been <strong>shared</strong>" : "Датотека или фолдер беше <strong>споделен</strong>", "You shared %1$s with %2$s" : "Вие споделивте %1$s со %2$s", "You shared %1$s with group %2$s" : "Вие споделивте %1$s со групата %2$s", "%2$s shared %1$s with you" : "%2$s споделено %1$s со вас", + "Downloaded via public link" : "Преземи преку јавен линк", + "Shared with %2$s" : "Споделено со %2$s", + "Shared with group %2$s" : "Споделено со група %2$s", + "Shared with %3$s by %2$s" : "Споделено со %3$s од %2$s", + "Shared with group %3$s by %2$s" : "Споделено со група %3$s од %2$s", + "Shared via link by %2$s" : "Споделено со врска/линк од %2$s", + "Shared by %2$s" : "Споделено од %2$s", + "Shared via public link" : "Споделено со јавна врска/линк", "Shares" : "Споделувања", + "Accept" : "Прифати", + "Decline" : "Одбиј", "This share is password-protected" : "Ова споделување е заштитено со лозинка", "The password is wrong. Try again." : "Лозинката е грешна. Обиди се повторно.", "Password" : "Лозинка", + "No entries found in this folder" : "Нема ништо во оваа папка", "Name" : "Име", "Share time" : "Сподели време", "Sorry, this link doesn’t seem to work anymore." : "Извенете, но овој линк изгледа дека повеќе не функционира.", @@ -21,8 +45,17 @@ "the link expired" : "времетраењето на линкот е изминато", "sharing is disabled" : "споделувањето не е дозволено", "For more info, please ask the person who sent this link." : "За повеќе информации, прашајте го лицето кое ви ја испратила врската.", + "Add to your ownCloud" : "Додади во вашиот ownCloud", "Download" : "Преземи", "Download %s" : "Преземи %s", - "Direct link" : "Директна врска" + "Direct link" : "Директна врска", + "Federated Cloud Sharing" : "Федерирано клауд споделување", + "Open documentation" : "Отвори ја документацијата", + "Federated Cloud" : "Федериран клауд", + "Your Federated Cloud ID:" : "Вашиот федериран Cloud ID:", + "Share it:" : "Сподели го:", + "Add to your website" : "Додади на твојот веб сајт", + "Share with me via ownCloud" : "Сподели со мене преку ownCloud", + "HTML Code:" : "HTML код:" },"pluralForm" :"nplurals=2; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : 1;" }
\ No newline at end of file diff --git a/apps/files_sharing/l10n/nl.js b/apps/files_sharing/l10n/nl.js index 7b31b7c73e2..523213f6d9b 100644 --- a/apps/files_sharing/l10n/nl.js +++ b/apps/files_sharing/l10n/nl.js @@ -3,6 +3,7 @@ OC.L10N.register( { "Server to server sharing is not enabled on this server" : "Server met server delen is niet geactiveerd op deze server", "The mountpoint name contains invalid characters." : "De naam van het mountpoint bevat ongeldige karakters.", + "Not allowed to create a federated share with the same user server" : "Het is niet toegestaan om een gefedereerde share met dezelfde gebruikersserver te maken", "Invalid or untrusted SSL certificate" : "Ongeldig of onvertrouwd SSL-certificaat", "Could not authenticate to remote share, password might be wrong" : "Kon niet authenticeren bij externe share, misschien verkeerd wachtwoord", "Storage not valid" : "Opslag ongeldig", diff --git a/apps/files_sharing/l10n/nl.json b/apps/files_sharing/l10n/nl.json index 92ba1c04268..e6501e874ea 100644 --- a/apps/files_sharing/l10n/nl.json +++ b/apps/files_sharing/l10n/nl.json @@ -1,6 +1,7 @@ { "translations": { "Server to server sharing is not enabled on this server" : "Server met server delen is niet geactiveerd op deze server", "The mountpoint name contains invalid characters." : "De naam van het mountpoint bevat ongeldige karakters.", + "Not allowed to create a federated share with the same user server" : "Het is niet toegestaan om een gefedereerde share met dezelfde gebruikersserver te maken", "Invalid or untrusted SSL certificate" : "Ongeldig of onvertrouwd SSL-certificaat", "Could not authenticate to remote share, password might be wrong" : "Kon niet authenticeren bij externe share, misschien verkeerd wachtwoord", "Storage not valid" : "Opslag ongeldig", diff --git a/apps/files_sharing/l10n/pt_BR.js b/apps/files_sharing/l10n/pt_BR.js index d2dac6d5955..2faf1455480 100644 --- a/apps/files_sharing/l10n/pt_BR.js +++ b/apps/files_sharing/l10n/pt_BR.js @@ -3,6 +3,7 @@ OC.L10N.register( { "Server to server sharing is not enabled on this server" : "Compartilhamento de servidor para servidor não está habilitado no servidor", "The mountpoint name contains invalid characters." : "O nome do ponto de montagem contém caracteres inválidos.", + "Not allowed to create a federated share with the same user server" : "Não permitido para criar um compartilhamento associado com o mesmo servidor do usuário", "Invalid or untrusted SSL certificate" : "Certificado SSL inválido ou não confiável", "Could not authenticate to remote share, password might be wrong" : "Não foi possível autenticação com o compartilhamento remoto, a senha deve estar errada", "Storage not valid" : "Armazenamento não válido", @@ -27,8 +28,8 @@ OC.L10N.register( "Shared by" : "Compartilhado por", "Sharing" : "Compartilhamento", "A file or folder has been <strong>shared</strong>" : "Um arquivo ou pasta foi <strong>compartilhado</strong> ", - "A file or folder was shared from <strong>another server</strong>" : "Um arquivo ou pasta foi compartilhada a partir de <strong>outro servidor</strong>", - "A public shared file or folder was <strong>downloaded</strong>" : "Um arquivo ou pasta compartilhada publicamente foi <strong>baixado</strong>", + "A file or folder was shared from <strong>another server</strong>" : "Um arquivo ou pasta foi compartilhado a partir de <strong>outro servidor</strong>", + "A public shared file or folder was <strong>downloaded</strong>" : "Um arquivo ou pasta compartilhado publicamente foi <strong>baixado</strong>", "You received a new remote share %2$s from %1$s" : "Você recebeu um novo conpartilhamento remoto %2$s de %1$s", "You received a new remote share from %s" : "Você recebeu um novo compartilhamento remoto de %s", "%1$s accepted remote share %2$s" : "%1$s aceitou o compartilhamento remoto %2$s", @@ -55,14 +56,14 @@ OC.L10N.register( "You received %2$s as a remote share from %1$s" : "Você recebeu %2$s como um compartilhamento remoto de %1$s", "Accept" : "Aceitar", "Decline" : "Rejeitar", - "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Compartilhe comigo através do meu #ownCloud Nuvem Federados ID, veja %s", - "Share with me through my #ownCloud Federated Cloud ID" : "Compartilhe comigo através do meu #ownCloud Nuvem Federados ID", + "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Compartilhe comigo através do meu #ownCloud Nuvem ID Associada, veja %s", + "Share with me through my #ownCloud Federated Cloud ID" : "Compartilhe comigo através do meu #ownCloud Nuvem ID Associada", "This share is password-protected" : "Este compartilhamento esta protegido por senha", "The password is wrong. Try again." : "Senha incorreta. Tente novamente.", "Password" : "Senha", "No entries found in this folder" : "Nenhuma entrada foi encontrada nesta pasta", "Name" : "Nome", - "Share time" : "Tempo de compartilhamento", + "Share time" : "Data compartilhado", "Sorry, this link doesn’t seem to work anymore." : "Desculpe, este link parece não mais funcionar.", "Reasons might be:" : "As razões podem ser:", "the item was removed" : "o item foi removido", @@ -73,12 +74,12 @@ OC.L10N.register( "Download" : "Baixar", "Download %s" : "Baixar %s", "Direct link" : "Link direto", - "Federated Cloud Sharing" : "Compartilhamento de Nuvem Conglomerada", + "Federated Cloud Sharing" : "Compartilhamento de Nuvem Associada", "Open documentation" : "Abrir documentação", "Allow users on this server to send shares to other servers" : "Permitir que os usuários deste servidor enviem compartilhamentos para outros servidores", "Allow users on this server to receive shares from other servers" : "Permitir que os usuários nesse servidor recebam compartilhamentos de outros servidores", - "Federated Cloud" : "Nuvem Conglomerada", - "Your Federated Cloud ID:" : "Seu Federados Nuvem ID:", + "Federated Cloud" : "Nuvem Associada", + "Your Federated Cloud ID:" : "Sua ID na Nuvem Associada:", "Share it:" : "Compartilhe:", "Add to your website" : "Adicione ao seu website", "Share with me via ownCloud" : "Compartilhe comigo via ownCloud", diff --git a/apps/files_sharing/l10n/pt_BR.json b/apps/files_sharing/l10n/pt_BR.json index e64c07ff8e0..51e6e9e6f0a 100644 --- a/apps/files_sharing/l10n/pt_BR.json +++ b/apps/files_sharing/l10n/pt_BR.json @@ -1,6 +1,7 @@ { "translations": { "Server to server sharing is not enabled on this server" : "Compartilhamento de servidor para servidor não está habilitado no servidor", "The mountpoint name contains invalid characters." : "O nome do ponto de montagem contém caracteres inválidos.", + "Not allowed to create a federated share with the same user server" : "Não permitido para criar um compartilhamento associado com o mesmo servidor do usuário", "Invalid or untrusted SSL certificate" : "Certificado SSL inválido ou não confiável", "Could not authenticate to remote share, password might be wrong" : "Não foi possível autenticação com o compartilhamento remoto, a senha deve estar errada", "Storage not valid" : "Armazenamento não válido", @@ -25,8 +26,8 @@ "Shared by" : "Compartilhado por", "Sharing" : "Compartilhamento", "A file or folder has been <strong>shared</strong>" : "Um arquivo ou pasta foi <strong>compartilhado</strong> ", - "A file or folder was shared from <strong>another server</strong>" : "Um arquivo ou pasta foi compartilhada a partir de <strong>outro servidor</strong>", - "A public shared file or folder was <strong>downloaded</strong>" : "Um arquivo ou pasta compartilhada publicamente foi <strong>baixado</strong>", + "A file or folder was shared from <strong>another server</strong>" : "Um arquivo ou pasta foi compartilhado a partir de <strong>outro servidor</strong>", + "A public shared file or folder was <strong>downloaded</strong>" : "Um arquivo ou pasta compartilhado publicamente foi <strong>baixado</strong>", "You received a new remote share %2$s from %1$s" : "Você recebeu um novo conpartilhamento remoto %2$s de %1$s", "You received a new remote share from %s" : "Você recebeu um novo compartilhamento remoto de %s", "%1$s accepted remote share %2$s" : "%1$s aceitou o compartilhamento remoto %2$s", @@ -53,14 +54,14 @@ "You received %2$s as a remote share from %1$s" : "Você recebeu %2$s como um compartilhamento remoto de %1$s", "Accept" : "Aceitar", "Decline" : "Rejeitar", - "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Compartilhe comigo através do meu #ownCloud Nuvem Federados ID, veja %s", - "Share with me through my #ownCloud Federated Cloud ID" : "Compartilhe comigo através do meu #ownCloud Nuvem Federados ID", + "Share with me through my #ownCloud Federated Cloud ID, see %s" : "Compartilhe comigo através do meu #ownCloud Nuvem ID Associada, veja %s", + "Share with me through my #ownCloud Federated Cloud ID" : "Compartilhe comigo através do meu #ownCloud Nuvem ID Associada", "This share is password-protected" : "Este compartilhamento esta protegido por senha", "The password is wrong. Try again." : "Senha incorreta. Tente novamente.", "Password" : "Senha", "No entries found in this folder" : "Nenhuma entrada foi encontrada nesta pasta", "Name" : "Nome", - "Share time" : "Tempo de compartilhamento", + "Share time" : "Data compartilhado", "Sorry, this link doesn’t seem to work anymore." : "Desculpe, este link parece não mais funcionar.", "Reasons might be:" : "As razões podem ser:", "the item was removed" : "o item foi removido", @@ -71,12 +72,12 @@ "Download" : "Baixar", "Download %s" : "Baixar %s", "Direct link" : "Link direto", - "Federated Cloud Sharing" : "Compartilhamento de Nuvem Conglomerada", + "Federated Cloud Sharing" : "Compartilhamento de Nuvem Associada", "Open documentation" : "Abrir documentação", "Allow users on this server to send shares to other servers" : "Permitir que os usuários deste servidor enviem compartilhamentos para outros servidores", "Allow users on this server to receive shares from other servers" : "Permitir que os usuários nesse servidor recebam compartilhamentos de outros servidores", - "Federated Cloud" : "Nuvem Conglomerada", - "Your Federated Cloud ID:" : "Seu Federados Nuvem ID:", + "Federated Cloud" : "Nuvem Associada", + "Your Federated Cloud ID:" : "Sua ID na Nuvem Associada:", "Share it:" : "Compartilhe:", "Add to your website" : "Adicione ao seu website", "Share with me via ownCloud" : "Compartilhe comigo via ownCloud", diff --git a/apps/files_sharing/l10n/sq.js b/apps/files_sharing/l10n/sq.js index 413214d58de..e25c170df9c 100644 --- a/apps/files_sharing/l10n/sq.js +++ b/apps/files_sharing/l10n/sq.js @@ -3,6 +3,7 @@ OC.L10N.register( { "Server to server sharing is not enabled on this server" : "Ndarja mes shërbyesish s’është e aktivizuar në këtë shërbyes", "The mountpoint name contains invalid characters." : "Emri i pikës së montimit përmban shenja të pavlefshme.", + "Not allowed to create a federated share with the same user server" : "Nuk i lejohet të krijojë një ndarje të federuar me të njëjtin shërbyes përdoruesi", "Invalid or untrusted SSL certificate" : "Dëshmi SSL e pavlefshme ose e pabesuar", "Could not authenticate to remote share, password might be wrong" : "S’bëri dot mirëfilltësimin te ndarja e largët, fjalëkalimi mund të jetë i gabuar", "Storage not valid" : "Depozitë jo e vlefshme", @@ -33,6 +34,7 @@ OC.L10N.register( "You received a new remote share from %s" : "Morët një ndarje të largët nga %s", "%1$s accepted remote share %2$s" : "%1$s pranoi ndarjen e largët %2$s", "%1$s declined remote share %2$s" : "%1$s hodhi tej ndarjen e largët %2$s", + "%1$s unshared %2$s from you" : "%1$s shndau me ju %2$s", "Public shared folder %1$s was downloaded" : "U shkarkua dosja e ndarë publikisht %1$s", "Public shared file %1$s was downloaded" : "U shkarkua kartela e ndarë publikisht %1$s", "You shared %1$s with %2$s" : "Ndatë %1$s me %2$s", @@ -72,9 +74,11 @@ OC.L10N.register( "Download" : "Shkarko", "Download %s" : "Shkarko %s", "Direct link" : "Lidhje e drejtpërdrejtë", + "Federated Cloud Sharing" : "Ndarje Në Re e Federuar ", "Open documentation" : "Hap dokumentimin", "Allow users on this server to send shares to other servers" : "Lejoju përdoruesve në këtë shërbyes të dërgojnë ndarje në shërbyes të tjerë", "Allow users on this server to receive shares from other servers" : "Lejoju përdoruesve në këtë shërbyes të marrin ndarje nga shërbyes të tjerë", + "Federated Cloud" : "Ndarje e Federuar", "Your Federated Cloud ID:" : "ID-ja juaj Federated Cloud:", "Share it:" : "Ndajeni:", "Add to your website" : "Shtojeni te sajti juaj", diff --git a/apps/files_sharing/l10n/sq.json b/apps/files_sharing/l10n/sq.json index 8722966f5da..d16d1710a55 100644 --- a/apps/files_sharing/l10n/sq.json +++ b/apps/files_sharing/l10n/sq.json @@ -1,6 +1,7 @@ { "translations": { "Server to server sharing is not enabled on this server" : "Ndarja mes shërbyesish s’është e aktivizuar në këtë shërbyes", "The mountpoint name contains invalid characters." : "Emri i pikës së montimit përmban shenja të pavlefshme.", + "Not allowed to create a federated share with the same user server" : "Nuk i lejohet të krijojë një ndarje të federuar me të njëjtin shërbyes përdoruesi", "Invalid or untrusted SSL certificate" : "Dëshmi SSL e pavlefshme ose e pabesuar", "Could not authenticate to remote share, password might be wrong" : "S’bëri dot mirëfilltësimin te ndarja e largët, fjalëkalimi mund të jetë i gabuar", "Storage not valid" : "Depozitë jo e vlefshme", @@ -31,6 +32,7 @@ "You received a new remote share from %s" : "Morët një ndarje të largët nga %s", "%1$s accepted remote share %2$s" : "%1$s pranoi ndarjen e largët %2$s", "%1$s declined remote share %2$s" : "%1$s hodhi tej ndarjen e largët %2$s", + "%1$s unshared %2$s from you" : "%1$s shndau me ju %2$s", "Public shared folder %1$s was downloaded" : "U shkarkua dosja e ndarë publikisht %1$s", "Public shared file %1$s was downloaded" : "U shkarkua kartela e ndarë publikisht %1$s", "You shared %1$s with %2$s" : "Ndatë %1$s me %2$s", @@ -70,9 +72,11 @@ "Download" : "Shkarko", "Download %s" : "Shkarko %s", "Direct link" : "Lidhje e drejtpërdrejtë", + "Federated Cloud Sharing" : "Ndarje Në Re e Federuar ", "Open documentation" : "Hap dokumentimin", "Allow users on this server to send shares to other servers" : "Lejoju përdoruesve në këtë shërbyes të dërgojnë ndarje në shërbyes të tjerë", "Allow users on this server to receive shares from other servers" : "Lejoju përdoruesve në këtë shërbyes të marrin ndarje nga shërbyes të tjerë", + "Federated Cloud" : "Ndarje e Federuar", "Your Federated Cloud ID:" : "ID-ja juaj Federated Cloud:", "Share it:" : "Ndajeni:", "Add to your website" : "Shtojeni te sajti juaj", diff --git a/apps/files_sharing/l10n/th_TH.js b/apps/files_sharing/l10n/th_TH.js index b1400469af8..b0022e9d959 100644 --- a/apps/files_sharing/l10n/th_TH.js +++ b/apps/files_sharing/l10n/th_TH.js @@ -3,6 +3,7 @@ OC.L10N.register( { "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" : "การจัดเก็บข้อมูลไม่ถูกต้อง", diff --git a/apps/files_sharing/l10n/th_TH.json b/apps/files_sharing/l10n/th_TH.json index a9ee8d6eb53..d973ad6ba19 100644 --- a/apps/files_sharing/l10n/th_TH.json +++ b/apps/files_sharing/l10n/th_TH.json @@ -1,6 +1,7 @@ { "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" : "การจัดเก็บข้อมูลไม่ถูกต้อง", diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php index fe7b159449c..e28019c358c 100644 --- a/apps/files_sharing/lib/controllers/sharecontroller.php +++ b/apps/files_sharing/lib/controllers/sharecontroller.php @@ -181,6 +181,7 @@ class ShareController extends Controller { $shareTmpl = []; $shareTmpl['displayName'] = User::getDisplayName($shareOwner); + $shareTmpl['owner'] = $shareOwner; $shareTmpl['filename'] = $file; $shareTmpl['directory_path'] = $linkItem['file_target']; $shareTmpl['mimetype'] = Filesystem::getMimeType($originalSharePath); diff --git a/apps/files_sharing/lib/external/storage.php b/apps/files_sharing/lib/external/storage.php index 2a0d827e064..36ff4f0c226 100644 --- a/apps/files_sharing/lib/external/storage.php +++ b/apps/files_sharing/lib/external/storage.php @@ -265,4 +265,12 @@ class Storage extends DAV implements ISharedStorage { list(, $remote) = explode('://', $this->remote, 2); return $this->remoteUser . '@' . $remote; } + + public function isSharable($path) { + if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) { + return false; + } + return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE); + } + } diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index cda3f564d5f..38f79762dc6 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -257,7 +257,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { } public function isSharable($path) { - if (\OCP\Util::isSharingDisabledForUser()) { + if (\OCP\Util::isSharingDisabledForUser() || !\OC\Share\Share::isResharingAllowed()) { return false; } return ($this->getPermissions($path) & \OCP\Constants::PERMISSION_SHARE); diff --git a/apps/files_sharing/lib/updater.php b/apps/files_sharing/lib/updater.php index 26044cc1c8e..2d165a5df04 100644 --- a/apps/files_sharing/lib/updater.php +++ b/apps/files_sharing/lib/updater.php @@ -58,6 +58,47 @@ class Shared_Updater { */ static public function renameHook($params) { self::renameChildren($params['oldpath'], $params['newpath']); + self::moveShareToShare($params['newpath']); + } + + /** + * Fix for https://github.com/owncloud/core/issues/20769 + * + * The owner is allowed to move their files (if they are shared) into a receiving folder + * In this case we need to update the parent of the moved share. Since they are + * effectively handing over ownership of the file the rest of the code needs to know + * they need to build up the reshare tree. + * + * @param string $path + */ + static private function moveShareToShare($path) { + $userFolder = \OC::$server->getUserFolder(); + $src = $userFolder->get($path); + + $type = $src instanceof \OCP\Files\File ? 'file' : 'folder'; + $shares = \OCP\Share::getItemShared($type, $src->getId()); + + // If the path we move is not a share we don't care + if (empty($shares)) { + return; + } + + // Check if the destination is inside a share + $mountManager = \OC::$server->getMountManager(); + $dstMount = $mountManager->find($src->getPath()); + if (!($dstMount instanceof \OCA\Files_Sharing\SharedMount)) { + return; + } + + $parenShare = $dstMount->getShare(); + + foreach ($shares as $share) { + $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder(); + $qb->update('share') + ->set('parent', $qb->createNamedParameter($parenShare['id'])) + ->where($qb->expr()->eq('id', $qb->createNamedParameter($share['id']))) + ->execute(); + } } /** diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index b5dd653d718..aa1f926ea35 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -41,7 +41,7 @@ $thumbSize = 1024; <input type="hidden" name="filename" value="<?php p($_['filename']) ?>" id="filename"> <input type="hidden" name="mimetype" value="<?php p($_['mimetype']) ?>" id="mimetype"> <input type="hidden" name="previewSupported" value="<?php p($_['previewSupported'] ? 'true' : 'false'); ?>" id="previewSupported"> -<input type="hidden" name="mimetypeIcon" value="<?php p(OC_Helper::mimetypeIcon($_['mimetype'])); ?>" id="mimetypeIcon"> +<input type="hidden" name="mimetypeIcon" value="<?php p(\OC::$server->getMimeTypeDetector()->mimeTypeIcon($_['mimetype'])); ?>" id="mimetypeIcon"> <input type="hidden" name="filesize" value="<?php p($_['nonHumanFileSize']); ?>" id="filesize"> <input type="hidden" name="maxSizeAnimateGif" value="<?php p($_['maxSizeAnimateGif']); ?>" id="maxSizeAnimateGif"> @@ -72,7 +72,7 @@ $thumbSize = 1024; if ($_['server2serversharing']) { ?> <span id="save" data-protected="<?php p($_['protected']) ?>" - data-owner="<?php p($_['displayName']) ?>" data-name="<?php p($_['filename']) ?>"> + data-owner-display-name="<?php p($_['displayName']) ?>" data-owner="<?php p($_['owner']) ?>" data-name="<?php p($_['filename']) ?>"> <button id="save-button"><?php p($l->t('Add to your ownCloud')) ?></button> <form class="save-form hidden" action="#"> <input type="text" id="remote_address" placeholder="example.com/owncloud"/> diff --git a/apps/files_sharing/tests/controller/sharecontroller.php b/apps/files_sharing/tests/controller/sharecontroller.php index ccef4263c2b..398538f0943 100644 --- a/apps/files_sharing/tests/controller/sharecontroller.php +++ b/apps/files_sharing/tests/controller/sharecontroller.php @@ -78,7 +78,7 @@ class ShareControllerTest extends \Test\TestCase { // Create a dummy user $this->user = \OC::$server->getSecureRandom()->getLowStrengthGenerator()->generate(12, ISecureRandom::CHAR_LOWER); - \OC_User::createUser($this->user, $this->user); + \OC::$server->getUserManager()->createUser($this->user, $this->user); \OC_Util::tearDownFS(); $this->loginAsUser($this->user); @@ -98,7 +98,8 @@ class ShareControllerTest extends \Test\TestCase { \OC_Util::tearDownFS(); \OC_User::setUserId(''); Filesystem::tearDown(); - \OC_User::deleteUser($this->user); + $user = \OC::$server->getUserManager()->get($this->user); + if ($user !== null) { $user->delete(); } \OC_User::setIncognitoMode(false); \OC::$server->getSession()->set('public_link_authenticated', ''); @@ -168,6 +169,7 @@ class ShareControllerTest extends \Test\TestCase { $response = $this->shareController->showShare($this->token); $sharedTmplParams = array( 'displayName' => $this->user, + 'owner' => $this->user, 'filename' => 'file1.txt', 'directory_path' => '/file1.txt', 'mimetype' => 'text/plain', diff --git a/apps/files_sharing/tests/etagpropagation.php b/apps/files_sharing/tests/etagpropagation.php index de9ce565394..5a917fd1c67 100644 --- a/apps/files_sharing/tests/etagpropagation.php +++ b/apps/files_sharing/tests/etagpropagation.php @@ -34,31 +34,7 @@ use OC\Files\View; * * @package OCA\Files_sharing\Tests */ -class EtagPropagation extends TestCase { - /** - * @var \OC\Files\View - */ - private $rootView; - protected $fileIds = []; // [$user=>[$path=>$id]] - protected $fileEtags = []; // [$id=>$etag] - - public static function setUpBeforeClass() { - parent::setUpBeforeClass(); - \OCA\Files_Sharing\Helper::registerHooks(); - } - - protected function setUp() { - parent::setUp(); - $this->setUpShares(); - } - - protected function tearDown() { - \OC_Hook::clear('OC_Filesystem', 'post_write'); - \OC_Hook::clear('OC_Filesystem', 'post_delete'); - \OC_Hook::clear('OC_Filesystem', 'post_rename'); - \OC_Hook::clear('OCP\Share', 'post_update_permissions'); - parent::tearDown(); - } +class EtagPropagation extends PropagationTestCase { /** * "user1" is the admin who shares a folder "sub1/sub2/folder" with "user2" and "user3" @@ -67,7 +43,7 @@ class EtagPropagation extends TestCase { * "user2" reshares the subdir "sub1/sub2/folder/inside" with "user4" * "user4" puts the received "inside" folder into "sub1/sub2/inside" (this is to check if it propagates across multiple subfolders) */ - private function setUpShares() { + protected function setUpShares() { $this->fileIds[self::TEST_FILES_SHARING_API_USER1] = []; $this->fileIds[self::TEST_FILES_SHARING_API_USER2] = []; $this->fileIds[self::TEST_FILES_SHARING_API_USER3] = []; @@ -136,58 +112,6 @@ class EtagPropagation extends TestCase { } } - /** - * @param string[] $users - * @param string $subPath - */ - private function assertEtagsChanged($users, $subPath = '') { - $oldUser = \OC::$server->getUserSession()->getUser(); - foreach ($users as $user) { - $this->loginAsUser($user); - $id = $this->fileIds[$user][$subPath]; - $path = $this->rootView->getPath($id); - $etag = $this->rootView->getFileInfo($path)->getEtag(); - $this->assertNotEquals($this->fileEtags[$id], $etag, 'Failed asserting that the etag for "' . $subPath . '" of user ' . $user . ' has changed'); - $this->fileEtags[$id] = $etag; - } - $this->loginAsUser($oldUser->getUID()); - } - - /** - * @param string[] $users - * @param string $subPath - */ - private function assertEtagsNotChanged($users, $subPath = '') { - $oldUser = \OC::$server->getUserSession()->getUser(); - foreach ($users as $user) { - $this->loginAsUser($user); - $id = $this->fileIds[$user][$subPath]; - $path = $this->rootView->getPath($id); - $etag = $this->rootView->getFileInfo($path)->getEtag(); - $this->assertEquals($this->fileEtags[$id], $etag, 'Failed asserting that the etag for "' . $subPath . '" of user ' . $user . ' has not changed'); - $this->fileEtags[$id] = $etag; - } - $this->loginAsUser($oldUser->getUID()); - } - - /** - * Assert that the etags for the root, /sub1 and /sub1/sub2 have changed - * - * @param string[] $users - */ - private function assertEtagsForFoldersChanged($users) { - $this->assertEtagsChanged($users); - - $this->assertEtagsChanged($users, 'sub1'); - $this->assertEtagsChanged($users, 'sub1/sub2'); - } - - private function assertAllUnchanged() { - $users = [self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, - self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_USER4]; - $this->assertEtagsNotChanged($users); - } - public function testOwnerWritesToShare() { $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); Filesystem::file_put_contents('/sub1/sub2/folder/asd.txt', 'bar'); diff --git a/apps/files_sharing/tests/groupetagpropagation.php b/apps/files_sharing/tests/groupetagpropagation.php new file mode 100644 index 00000000000..804d064eadb --- /dev/null +++ b/apps/files_sharing/tests/groupetagpropagation.php @@ -0,0 +1,104 @@ +<?php +/** + * @author Robin Appelman <icewind@owncloud.com> + * + * @copyright Copyright (c) 2015, 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\Tests; + +use OC\Files\Filesystem; +use OC\Files\View; + +/** + * @group DB + * + * @package OCA\Files_sharing\Tests + */ +class GroupEtagPropagation extends PropagationTestCase { + /** + * "user1" creates /test, /test/sub and shares with group1 + * "user2" (in group1) reshares /test with group2 and reshared /test/sub with group3 + * "user3" (in group 2) + * "user4" (in group 3) + */ + protected function setUpShares() { + $this->fileIds[self::TEST_FILES_SHARING_API_USER1] = []; + $this->fileIds[self::TEST_FILES_SHARING_API_USER2] = []; + $this->fileIds[self::TEST_FILES_SHARING_API_USER3] = []; + $this->fileIds[self::TEST_FILES_SHARING_API_USER4] = []; + + $this->rootView = new View(''); + $this->loginAsUser(self::TEST_FILES_SHARING_API_USER1); + $view1 = new View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files'); + $view1->mkdir('/test/sub'); + $folderInfo = $view1->getFileInfo('/test'); + \OCP\Share::shareItem('folder', $folderInfo->getId(), \OCP\Share::SHARE_TYPE_GROUP, 'group1', 31); + $this->fileIds[self::TEST_FILES_SHARING_API_USER1][''] = $view1->getFileInfo('')->getId(); + $this->fileIds[self::TEST_FILES_SHARING_API_USER1]['test'] = $view1->getFileInfo('test')->getId(); + $this->fileIds[self::TEST_FILES_SHARING_API_USER1]['test/sub'] = $view1->getFileInfo('test/sub')->getId(); + + $this->loginAsUser(self::TEST_FILES_SHARING_API_USER2); + $view2 = new View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files'); + $folderInfo = $view2->getFileInfo('/test'); + $subFolderInfo = $view2->getFileInfo('/test/sub'); + \OCP\Share::shareItem('folder', $folderInfo->getId(), \OCP\Share::SHARE_TYPE_GROUP, 'group2', 31); + \OCP\Share::shareItem('folder', $subFolderInfo->getId(), \OCP\Share::SHARE_TYPE_GROUP, 'group3', 31); + $this->fileIds[self::TEST_FILES_SHARING_API_USER2][''] = $view2->getFileInfo('')->getId(); + $this->fileIds[self::TEST_FILES_SHARING_API_USER2]['test'] = $view2->getFileInfo('test')->getId(); + $this->fileIds[self::TEST_FILES_SHARING_API_USER2]['test/sub'] = $view2->getFileInfo('test/sub')->getId(); + + $this->loginAsUser(self::TEST_FILES_SHARING_API_USER3); + $view3 = new View('/' . self::TEST_FILES_SHARING_API_USER3 . '/files'); + $this->fileIds[self::TEST_FILES_SHARING_API_USER3][''] = $view3->getFileInfo('')->getId(); + $this->fileIds[self::TEST_FILES_SHARING_API_USER3]['test'] = $view3->getFileInfo('test')->getId(); + $this->fileIds[self::TEST_FILES_SHARING_API_USER3]['test/sub'] = $view3->getFileInfo('test/sub')->getId(); + + $this->loginAsUser(self::TEST_FILES_SHARING_API_USER4); + $view4 = new View('/' . self::TEST_FILES_SHARING_API_USER4 . '/files'); + $this->fileIds[self::TEST_FILES_SHARING_API_USER4][''] = $view4->getFileInfo('')->getId(); + $this->fileIds[self::TEST_FILES_SHARING_API_USER4]['sub'] = $view4->getFileInfo('sub')->getId(); + + foreach ($this->fileIds as $user => $ids) { + $this->loginAsUser($user); + foreach ($ids as $id) { + $path = $this->rootView->getPath($id); + $this->fileEtags[$id] = $this->rootView->getFileInfo($path)->getEtag(); + } + } + } + + public function testGroupReShareRecipientWrites() { + $this->loginAsUser(self::TEST_FILES_SHARING_API_USER3); + + Filesystem::file_put_contents('/test/sub/file.txt', 'asd'); + + $this->assertEtagsChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_USER4]); + + $this->assertAllUnchanged(); + } + + public function testGroupReShareSubFolderRecipientWrites() { + $this->loginAsUser(self::TEST_FILES_SHARING_API_USER4); + + Filesystem::file_put_contents('/sub/file.txt', 'asd'); + + $this->assertEtagsChanged([self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_USER4]); + + $this->assertAllUnchanged(); + } +} diff --git a/apps/files_sharing/tests/js/externalSpec.js b/apps/files_sharing/tests/js/externalSpec.js index 255f0fc3a48..362df49252b 100644 --- a/apps/files_sharing/tests/js/externalSpec.js +++ b/apps/files_sharing/tests/js/externalSpec.js @@ -67,6 +67,7 @@ describe('OCA.Sharing external tests', function() { remote: 'http://example.com/owncloud', token: 'abcdefg', owner: 'theowner', + ownerDisplayName: 'The Generous Owner', name: 'the share name' }; }); @@ -88,6 +89,7 @@ describe('OCA.Sharing external tests', function() { remote: 'http://example.com/owncloud', token: 'abcdefg', owner: 'theowner', + ownerDisplayName: 'The Generous Owner', name: 'the share name', password: '' }); @@ -104,6 +106,7 @@ describe('OCA.Sharing external tests', function() { remote: 'http://example.com/owncloud', token: 'abcdefg', owner: 'theowner', + ownerDisplayName: 'The Generous Owner', name: 'the share name', password: 'thepassword' }); @@ -148,6 +151,7 @@ describe('OCA.Sharing external tests', function() { remote: 'http://example.com/owncloud', token: 'abcdefg', owner: 'theowner', + ownerDisplayName: 'The Generous Owner', name: 'the share name' }; }); diff --git a/apps/files_sharing/tests/js/publicAppSpec.js b/apps/files_sharing/tests/js/publicAppSpec.js index 74f008025e1..2aaf758f3e3 100644 --- a/apps/files_sharing/tests/js/publicAppSpec.js +++ b/apps/files_sharing/tests/js/publicAppSpec.js @@ -89,7 +89,8 @@ describe('OCA.Sharing.PublicApp tests', function() { it('Uses public webdav endpoint', function() { expect(fakeServer.requests.length).toEqual(1); expect(fakeServer.requests[0].method).toEqual('PROPFIND'); - expect(fakeServer.requests[0].url).toEqual('https://sh4tok@example.com/owncloud/public.php/webdav/subdir'); + expect(fakeServer.requests[0].url).toEqual('https://example.com/owncloud/public.php/webdav/subdir'); + expect(fakeServer.requests[0].requestHeaders.Authorization).toEqual('Basic c2g0dG9rOm51bGw='); }); describe('Download Url', function() { diff --git a/apps/files_sharing/tests/js/sharedfilelistSpec.js b/apps/files_sharing/tests/js/sharedfilelistSpec.js index fdc9de49c17..0b0676a19e6 100644 --- a/apps/files_sharing/tests/js/sharedfilelistSpec.js +++ b/apps/files_sharing/tests/js/sharedfilelistSpec.js @@ -712,7 +712,7 @@ describe('OCA.Sharing.FileList tests', function() { $tr = fileList.$el.find('tr:first'); expect(parseInt($tr.attr('data-share-permissions'), 10)) - .toEqual(OC.PERMISSION_ALL - OC.PERMISSION_SHARE - OC.PERMISSION_DELETE); + .toEqual(OC.PERMISSION_ALL - OC.PERMISSION_SHARE - OC.PERMISSION_DELETE - OC.PERMISSION_CREATE); }); }); }); diff --git a/apps/files_sharing/tests/propagationtestcase.php b/apps/files_sharing/tests/propagationtestcase.php new file mode 100644 index 00000000000..f397c1fb7a0 --- /dev/null +++ b/apps/files_sharing/tests/propagationtestcase.php @@ -0,0 +1,103 @@ +<?php +/** + * @author Robin Appelman <icewind@owncloud.com> + * + * @copyright Copyright (c) 2015, 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\Tests; + +abstract class PropagationTestCase extends TestCase { + /** + * @var \OC\Files\View + */ + protected $rootView; + protected $fileIds = []; // [$user=>[$path=>$id]] + protected $fileEtags = []; // [$id=>$etag] + + public static function setUpBeforeClass() { + parent::setUpBeforeClass(); + \OCA\Files_Sharing\Helper::registerHooks(); + } + + protected function setUp() { + parent::setUp(); + $this->setUpShares(); + } + + protected function tearDown() { + \OC_Hook::clear('OC_Filesystem', 'post_write'); + \OC_Hook::clear('OC_Filesystem', 'post_delete'); + \OC_Hook::clear('OC_Filesystem', 'post_rename'); + \OC_Hook::clear('OCP\Share', 'post_update_permissions'); + parent::tearDown(); + } + + abstract protected function setUpShares(); + + /** + * @param string[] $users + * @param string $subPath + */ + protected function assertEtagsChanged($users, $subPath = '') { + $oldUser = \OC::$server->getUserSession()->getUser(); + foreach ($users as $user) { + $this->loginAsUser($user); + $id = $this->fileIds[$user][$subPath]; + $path = $this->rootView->getPath($id); + $etag = $this->rootView->getFileInfo($path)->getEtag(); + $this->assertNotEquals($this->fileEtags[$id], $etag, 'Failed asserting that the etag for "' . $subPath . '" of user ' . $user . ' has changed'); + $this->fileEtags[$id] = $etag; + } + $this->loginAsUser($oldUser->getUID()); + } + + /** + * @param string[] $users + * @param string $subPath + */ + protected function assertEtagsNotChanged($users, $subPath = '') { + $oldUser = \OC::$server->getUserSession()->getUser(); + foreach ($users as $user) { + $this->loginAsUser($user); + $id = $this->fileIds[$user][$subPath]; + $path = $this->rootView->getPath($id); + $etag = $this->rootView->getFileInfo($path)->getEtag(); + $this->assertEquals($this->fileEtags[$id], $etag, 'Failed asserting that the etag for "' . $subPath . '" of user ' . $user . ' has not changed'); + $this->fileEtags[$id] = $etag; + } + $this->loginAsUser($oldUser->getUID()); + } + + /** + * Assert that the etags for the root, /sub1 and /sub1/sub2 have changed + * + * @param string[] $users + */ + protected function assertEtagsForFoldersChanged($users) { + $this->assertEtagsChanged($users); + + $this->assertEtagsChanged($users, 'sub1'); + $this->assertEtagsChanged($users, 'sub1/sub2'); + } + + protected function assertAllUnchanged() { + $users = [self::TEST_FILES_SHARING_API_USER1, self::TEST_FILES_SHARING_API_USER2, + self::TEST_FILES_SHARING_API_USER3, self::TEST_FILES_SHARING_API_USER4]; + $this->assertEtagsNotChanged($users); + } +} diff --git a/apps/files_sharing/tests/testcase.php b/apps/files_sharing/tests/testcase.php index dc5b8ed79d9..c4037c7c42e 100644 --- a/apps/files_sharing/tests/testcase.php +++ b/apps/files_sharing/tests/testcase.php @@ -84,9 +84,15 @@ abstract class TestCase extends \Test\TestCase { $groupBackend = new \OC_Group_Dummy(); $groupBackend->createGroup(self::TEST_FILES_SHARING_API_GROUP1); $groupBackend->createGroup('group'); + $groupBackend->createGroup('group1'); + $groupBackend->createGroup('group2'); + $groupBackend->createGroup('group3'); $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER1, 'group'); $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, 'group'); $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER3, 'group'); + $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, 'group1'); + $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER3, 'group2'); + $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER4, 'group3'); $groupBackend->addToGroup(self::TEST_FILES_SHARING_API_USER2, self::TEST_FILES_SHARING_API_GROUP1); \OC_Group::useBackend($groupBackend); @@ -111,9 +117,12 @@ abstract class TestCase extends \Test\TestCase { public static function tearDownAfterClass() { // cleanup users - \OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER1); - \OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER2); - \OC_User::deleteUser(self::TEST_FILES_SHARING_API_USER3); + $user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER1); + if ($user !== null) { $user->delete(); } + $user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER2); + if ($user !== null) { $user->delete(); } + $user = \OC::$server->getUserManager()->get(self::TEST_FILES_SHARING_API_USER3); + if ($user !== null) { $user->delete(); } // delete group \OC_Group::deleteGroup(self::TEST_FILES_SHARING_API_GROUP1); @@ -143,7 +152,7 @@ abstract class TestCase extends \Test\TestCase { } if ($create) { - \OC_User::createUser($user, $password); + \OC::$server->getUserManager()->createUser($user, $password); \OC_Group::createGroup('group'); \OC_Group::addToGroup($user, 'group'); } |