Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
0c9d9e1
Update changelog for 10.2.0 RC1
Apr 11, 2019
ca10ecb
Merge pull request #35005 from owncloud/release-10.2.0-changelog
Apr 11, 2019
1c7b738
Set version to 10.2.0 RC1
patrickjahns Apr 11, 2019
678a402
Fix missing progress bar in files drop view
Apr 16, 2019
0c4a39b
vfsstream tokenizer dependency bumps
phil-davis Apr 11, 2019
4641f9e
Bump symfony (v3.4.24 => v3.4.25)
phil-davis Apr 17, 2019
18d2a75
Bump symfony (v3.4.25 => v3.4.26)
phil-davis Apr 18, 2019
f454958
Wrong translation file referenced for accept & decline share
jmdeboer-surfsara Apr 17, 2019
b3da5af
Fixup files_sharing translation calls
phil-davis Apr 17, 2019
fb6db60
Fixup files_trashbin translation calls
phil-davis Apr 17, 2019
8c46e98
Fixup federatedfilesharing translation calls
phil-davis Apr 17, 2019
e0200bd
Fixup files_versions translation calls
phil-davis Apr 17, 2019
0f6fa7c
Use consistent app name in writeLog() calls
phil-davis Apr 17, 2019
42a695e
Point to current installation instructions in README
phil-davis Apr 17, 2019
1863ae6
Merge pull request #35064 from owncloud/readme-release-10.2.0
Apr 18, 2019
8635818
Merge pull request #35059 from owncloud/release-10.2.0-fix-file-drop-…
Apr 18, 2019
80ce8d6
Merge pull request #35062 from owncloud/dependency-bumps-release-10.2.0
Apr 18, 2019
4a80725
Merge pull request #35063 from owncloud/translation-release-10.2.0
Apr 18, 2019
1e09437
Filter unavailable users
VicDeo Apr 12, 2019
6af63ae
Remove unavailable shares
VicDeo Apr 16, 2019
7c80bcb
[stable10] Backport of Remove share permission check from the file up…
sharidas Apr 18, 2019
f7a4610
Merge pull request #35082 from owncloud/remove-sharepermission-check-…
Apr 23, 2019
73beb5d
Merge pull request #35073 from owncloud/release-10.2.0-improve-polling
Apr 25, 2019
ae83531
Respect 'writable' appdir flag on update
VicDeo Apr 22, 2019
37abcee
add new capability privateLinksDetailsParam
karakayasemi Apr 26, 2019
40ea331
Merge pull request #35104 from owncloud/bp-35101
Apr 26, 2019
d310a5d
Merge pull request #35097 from owncloud/release-10.2.0-fix-35031
Apr 29, 2019
17549f7
Avoid headers set twice in some situations
Apr 29, 2019
38bf52c
Merge pull request #35118 from benrubson/headers102
Apr 29, 2019
7729aae
Add the requiredPermissions property for extra share attributes
LinneyS Apr 9, 2019
1201c7d
Add js tests for share attributes
mrow4a Apr 13, 2019
08df687
Refactor share attribute js tests
mrow4a Apr 29, 2019
98e77f0
When reshared disallow changing share attributes
mrow4a Apr 27, 2019
5c9e26c
Merge pull request #35095 from owncloud/release-10.2.0-share_attribut…
Apr 30, 2019
5111ea7
[stable10] Backport of Aborted uploads are not cleared properly
sharidas Apr 30, 2019
dabfab2
[10.2.0] Backport of dont show notification if federated share autoac…
karakayasemi Apr 30, 2019
73b6d92
Set mail_send via old share API
VicDeo May 2, 2019
c515df5
Merge pull request #35134 from owncloud/fix-upload-cancel-issue-relea…
May 2, 2019
b4ca957
Merge pull request #35135 from owncloud/fix-fed-not-release-10.2.0
May 2, 2019
8597b07
Merge pull request #35137 from owncloud/release-10.2.0-fixup-35089
May 2, 2019
e801e4e
Update changelog for 10.2.0 RC2
May 2, 2019
7656477
Wait for form to load when following password reset link
skshetry Apr 29, 2019
de67a15
Merge pull request #35140 from owncloud/release-10.2.0-changelog-update
May 2, 2019
126a5ad
Merge pull request #35139 from owncloud/release-10.2.0-wait-password-…
May 2, 2019
e37958c
Set version to 10.2.0RC2
patrickjahns May 2, 2019
d112634
[10.2.0] Backport of Fix update share permissions for public link
sharidas May 6, 2019
6237fae
Merge pull request #35159 from owncloud/fix-update-share-permissions-…
May 7, 2019
d588b4a
[10.2.0] Backport of Fix permission and update behaviour for public link
sharidas May 9, 2019
6551672
Merge pull request #35197 from owncloud/update-permission-and-behavio…
May 10, 2019
24e0e79
Set version to 10.2.0RC3
patrickjahns May 10, 2019
b54f30c
Treat send attempt unsuccessful when there is a message.
VicDeo May 14, 2019
472797b
encode jobs that have an array as job value
patrickjahns May 14, 2019
eb18d9c
Merge pull request #35228 from owncloud/release-10.2.0-fix-35222-job-…
May 15, 2019
4cbc7f4
[10.2.0] Backport of The public link edit template was outside public…
sharidas May 15, 2019
d4c88d5
Merge pull request #35238 from owncloud/fix-public-link-view-issue-re…
May 15, 2019
4180eda
Merge pull request #35221 from owncloud/release-10.2.0-fix-35218
May 16, 2019
c1e42e3
Update changelog for 10.2.0 RC4
patrickjahns May 16, 2019
2bfe9b8
set version to 10.2.0RC4
patrickjahns May 16, 2019
f6f9f45
Update README.md file with 10.2 version
davitol May 16, 2019
f37a8c7
Add webUI tests for share mail notification
paurakhsharma May 14, 2019
0bb02f2
Unskip behat step and remove issue tag
paurakhsharma May 16, 2019
08f31fe
Merge pull request #35243 from owncloud/release-10.2.0-update-changelog
patrickjahns May 16, 2019
08aa9ff
Merge pull request #35244 from owncloud/release-10.2.0-update-readme
patrickjahns May 16, 2019
f8bedb7
Merge pull request #35240 from owncloud/release-10.2.0-test-share-mai…
patrickjahns May 16, 2019
28bc7ab
set version to 10.2.0
patrickjahns May 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,7 @@ matrix:
CHOWN_SERVER: true
OWNCLOUD_LOG: true
INSTALL_TESTING_APP: true
USE_EMAIL: true

- PHP_VERSION: 7.1
TEST_SUITE: selenium
Expand All @@ -1274,6 +1275,7 @@ matrix:
CHOWN_SERVER: true
OWNCLOUD_LOG: true
INSTALL_TESTING_APP: true
USE_EMAIL: true

- PHP_VERSION: 7.1
TEST_SUITE: selenium
Expand Down
9 changes: 8 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,30 @@

<IfModule mod_env.c>
# Add security and privacy related headers
Header unset X-Content-Type-Options
Header always set X-Content-Type-Options "nosniff"
Header unset X-XSS-Protection
Header always set X-XSS-Protection "1; mode=block"
Header unset X-Robots-Tag
Header always set X-Robots-Tag "none"
Header unset X-Frame-Options
Header always set X-Frame-Options "SAMEORIGIN"
Header unset X-Download-Options
Header always set X-Download-Options "noopen"
Header unset X-Permitted-Cross-Domain-Policies
Header always set X-Permitted-Cross-Domain-Policies "none"
SetEnv modHeadersAvailable true
</IfModule>

# Let browsers cache CSS, JS files for half a year
<FilesMatch "\.(css|js)$">
Header unset Cache-Control
Header always set Cache-Control "max-age=15778463"
</FilesMatch>

# Let browsers cache WOFF files for a week
<FilesMatch "\.woff$">
Header unset Cache-Control
Header always set Cache-Control "max-age=604800"
</FilesMatch>
</IfModule>
Expand Down Expand Up @@ -84,4 +92,3 @@ Options -Indexes
<IfModule pagespeed_module>
ModPagespeed Off
</IfModule>

34 changes: 19 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [Unreleased]
## [10.2.0] - 2019-05-16

### Added

- Add new capability to advertise the availability of the detail parameter for private links - [#35104](https://github.com/owncloud/core/issues/35104)
- Add background:queue:execute occ command for running cron jobs manually - [#34995](https://github.com/owncloud/core/issues/34995)
- Adding background:queue commands: status and delete - [#34783](https://github.com/owncloud/core/issues/34783) [#35228](https://github.com/owncloud/core/pull/35228)
- Added new permissions option for public link - [#34983](https://github.com/owncloud/core/issues/34983) [#35082](https://github.com/owncloud/core/issues/35082)[#35159](https://github.com/owncloud/core/pull/35159)[#35197](https://github.com/owncloud/core/pull/35197)[#35238](https://github.com/owncloud/core/pull/35238)
- Support for extra share key-value attributes - [#34951](https://github.com/owncloud/core/issues/34951)
- Internal permission to prevent file download when set in share attribute, for "secure view" feature - [#34951](https://github.com/owncloud/core/issues/34951)
- Support for automatically accepting incoming federated shares from trusted servers - [#34206](https://github.com/owncloud/core/issues/34206)
- Internal permission to prevent file download when set in share attribute, for "secure view" feature - [#34951](https://github.com/owncloud/core/issues/34951) [#35095](https://github.com/owncloud/core/issues/35095)
- Support for automatically accepting incoming federated shares from trusted servers - [#34206](https://github.com/owncloud/core/issues/34206) [#35135](https://github.com/owncloud/core/issues/35135)
- User option for automatically accepting incoming shares - [#34647](https://github.com/owncloud/core/pull/34647) [#34842](https://github.com/owncloud/core/pull/34842) [#34934](https://github.com/owncloud/core/issues/34934)
- User option for automatically accepting incoming federated shares - [#34706](https://github.com/owncloud/core/issues/34706)
- User option to opt-out autocomplete in share dialog - [#34942](https://github.com/owncloud/core/issues/34942)
Expand All @@ -28,7 +32,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Allow admins to enable medial search on group and user - [#34779](https://github.com/owncloud/core/issues/34779)
- Add composer cleaner - [#34784](https://github.com/owncloud/core/issues/34784)
- Add events for user preference changes - [#34820](https://github.com/owncloud/core/issues/34820)
- Add occ command to poll incoming federated shares for updates - [#34933](https://github.com/owncloud/core/issues/34933) [#34959](https://github.com/owncloud/core/issues/34959)
- Add occ command to poll incoming federated shares for updates - [#34933](https://github.com/owncloud/core/issues/34933) [#34959](https://github.com/owncloud/core/issues/34959) [#34993](https://github.com/owncloud/core/issues/34993) [#35073](https://github.com/owncloud/core/issues/35073)

### Changed

Expand All @@ -52,17 +56,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Bump react promise v2.7.1 - [#34416](https://github.com/owncloud/core/issues/34416)
- Zendframework bumps 20190208 - [#34413](https://github.com/owncloud/core/issues/34413)
- Bump paragonie/random_compat v2.0.17 => v2.0.18 - [#34043](https://github.com/owncloud/core/issues/34043)
- Bump pear/archive_tar from 1.4.6 to 1.4.7 - [#34990](https://github.com/owncloud/core/issues/34990)
- Bump phpseclib/phpseclib from 2.0.13 to 2.0.15 - [#34285](https://github.com/owncloud/core/issues/34285) [#34741](https://github.com/owncloud/core/issues/34741)
- Bump pimple/pimple from 3.0.2 to 3.2.3 - [#31753](https://github.com/owncloud/core/issues/31753)
- Bump sinon from 7.1.1 to 7.3.1 in /build - [#34881](https://github.com/owncloud/core/issues/34881) [#34943](https://github.com/owncloud/core/issues/34943)
- Bump symfony v3.4.20 => v3.4.24 - [#34042](https://github.com/owncloud/core/issues/34042) [#34663](https://github.com/owncloud/core/issues/34663) [#34954](https://github.com/owncloud/core/issues/34954)
- Bump symfony/process from 3.4.21 to 3.4.22 - [#34407](https://github.com/owncloud/core/issues/34407)
- Bump symfony/translation from 3.4.21 to 3.4.22 - [#34406](https://github.com/owncloud/core/issues/34406)
- Bump symfony/console from 3.4.21 to 3.4.22 - [#34404](https://github.com/owncloud/core/issues/34404)
- Bump symfony and modules to 3.4.26 - [#35062](https://github.com/owncloud/core/issues/35062)
- Bump symfony/polyfill components from v1.10.0 to v1.11.0 - [#34882](https://github.com/owncloud/core/pull/34882)
- Bump symfony/routing from 3.4.21 to 3.4.22 - [#34408](https://github.com/owncloud/core/issues/34408)
- Bump symfony/event-dispatcher from 3.4.21 to 3.4.22 - [#34405](https://github.com/owncloud/core/issues/34405)
- Bump remaining symfony 3.4.22 components - [#34412](https://github.com/owncloud/core/issues/34412)
- Bump deepdiver1975/tarstreamer from 0.1.0 to 0.1.1 - [#34615](https://github.com/owncloud/core/issues/34615)
- Bump zendframework/zend-servicemanager from 3.3.2 to 3.4.0 - [#33971](https://github.com/owncloud/core/issues/33971)
- Bump zendframework/zend-inputfilter from 2.9.0 to 2.9.1 - [#34145](https://github.com/owncloud/core/issues/34145)
Expand All @@ -76,7 +75,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Add email footer with motto in email for changing password - [#34498](https://github.com/owncloud/core/issues/34498)
- Change the styling of the active settings navigation menu item - [#34561](https://github.com/owncloud/core/issues/34561)
- Added delay in search field - [#34613](https://github.com/owncloud/core/issues/34613)
- Tidy up code for notification by email - [#34786](https://github.com/owncloud/core/issues/34786)
- Tidy up code for notification by email - [#34786](https://github.com/owncloud/core/issues/34786) [#35137](https://github.com/owncloud/core/issues/35137)
- Some code now made PHP 7 specific - [#34925](https://github.com/owncloud/core/issues/34925)

### Removed
Expand All @@ -88,6 +87,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Fixed

- Wrong translation file referenced for accept & decline share - [#35063](https://github.com/owncloud/core/issues/35063)
- Respect 'writable' appdir flag on update - [#35097](https://github.com/owncloud/core/issues/35097)
- Aborted uploads in web UI are now properly cleared - [#35134](https://github.com/owncloud/core/issues/35134)
- Fix regression with missing progress bar in files drop view - [#35059](https://github.com/owncloud/core/issues/35059)
- Log exception when background job class not found - [#34723](https://github.com/owncloud/core/issues/34723)
- Prevent concurrent updates in group shares to avoid duplicate entries - [#34769](https://github.com/owncloud/core/issues/34769)
- Calender invitation now uses actual sender name - [#34901](https://github.com/owncloud/core/issues/34901)
- Fix public link share default expiration behavior - [#34971](https://github.com/owncloud/core/issues/34971)
Expand All @@ -96,7 +100,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Reduce sharing query size by properly reusing the query builder - [#34915](https://github.com/owncloud/core/issues/34915)
- Tar download support for file names longer than 99 chars - [#34615](https://github.com/owncloud/core/issues/34615)
- Fix Webdav error page, include CSP and message - [#34817](https://github.com/owncloud/core/issues/34817)
- Handle accept decline with invalid share id - [#34786](https://github.com/owncloud/core/issues/34786)
- Handle accept decline with invalid share id - [#34786](https://github.com/owncloud/core/issues/34786) [#35221](https://github.com/owncloud/core/pull/35221)
- Normalize path when moving chunks to final destination - [#34777](https://github.com/owncloud/core/issues/34777)
- Better support for international email addresses after swiftmailer update - [#34759](https://github.com/owncloud/core/issues/34759)
- Fix first time login handling - [#34758](https://github.com/owncloud/core/issues/34758)
Expand Down Expand Up @@ -130,7 +134,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fix reset confirmation mail from occ - [#34154](https://github.com/owncloud/core/issues/34154)
- Correctly write Login failed entry in log when 2FA is enforced - [#34055](https://github.com/owncloud/core/issues/34055)
- Center the logo and login fields - [#34057](https://github.com/owncloud/core/issues/34057)
- Fix Apache warnings by setting headers to "always" in htaccess - [#34089](https://github.com/owncloud/core/issues/34089)
- Fix Apache warnings by setting headers to "always" in htaccess - [#34089](https://github.com/owncloud/core/issues/34089) [#35118](https://github.com/owncloud/core/issues/35118)
- Fix external storage advanced checkbox state issue - [#34168](https://github.com/owncloud/core/issues/34168)
- Set permissions on log file creation instead of every write - [#34061](https://github.com/owncloud/core/issues/34061)
- Images are again properly rotated now based on EXIF rotation - [#34356](https://github.com/owncloud/core/issues/34356)
Expand Down Expand Up @@ -1018,7 +1022,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- provisioning API now also returns the user's home path: [#26850](https://github.com/owncloud/core/issues/26850)
- web updater shows link to changelog in admin page: [#26796](https://github.com/owncloud/core/issues/26796)

[Unreleased]: https://github.com/owncloud/core/compare/v10.1.1...stable10
[10.2.0]: https://github.com/owncloud/core/compare/v10.1.1...v10.2.0
[10.1.1]: https://github.com/owncloud/core/compare/v10.1.0...v10.1.1
[10.1.0]: https://github.com/owncloud/core/compare/v10.0.10...v10.1.0
[10.0.10]: https://github.com/owncloud/core/compare/v10.0.9...v10.0.10
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A personal cloud which runs on your own server.**
* ...

## Installation instructions
https://doc.owncloud.org/server/10.1/developer_manual/app/index.html
https://doc.owncloud.org/server/10.2/admin_manual/installation/

## Contribution Guidelines
https://owncloud.org/contribute/
Expand All @@ -38,4 +38,4 @@ Please submit translations via Transifex:
https://www.transifex.com/projects/p/owncloud/

For detailed information about translations:
https://doc.owncloud.org/server/10.1/developer_manual/core/translation.html
https://doc.owncloud.org/server/10.2/developer_manual/core/translation.html
2 changes: 1 addition & 1 deletion apps/federatedfilesharing/js/public.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$(document).ready(function() {
$('#header #details').prepend(
'<span id="save">' +
' <button id="save-button">'+t('files_sharing', 'Add to your ownCloud')+'</button>' +
' <button id="save-button">'+t('federatedfilesharing', 'Add to your ownCloud')+'</button>' +
' <form class="save-form hidden" action="#">' +
' <input type="text" id="remote_address" placeholder="example.com/owncloud"/>' +
' <button id="save-button-confirm" class="icon-confirm svg" disabled></button>' +
Expand Down
3 changes: 3 additions & 0 deletions apps/federatedfilesharing/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,18 @@ function ($c) {
function ($c) use ($server) {
if ($server->getAppManager()->isEnabledForUser('files_sharing')) {
$sharingApp = new \OCA\Files_Sharing\AppInfo\Application();
$externalManager = $sharingApp->getContainer()->query('ExternalManager');
$externalMountProvider = $sharingApp->getContainer()->query('ExternalMountProvider');
} else {
$externalManager = null;
$externalMountProvider = null;
}

return new PollIncomingShares(
$server->getDatabaseConnection(),
$server->getUserManager(),
\OC\Files\Filesystem::getLoader(),
$externalManager,
$externalMountProvider
);
}
Expand Down
41 changes: 35 additions & 6 deletions apps/federatedfilesharing/lib/Command/PollIncomingShares.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
namespace OCA\FederatedFileSharing\Command;

use OC\ServerNotAvailableException;
use OC\User\NoUserException;
use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Files_Sharing\External\Manager;
use OCA\Files_Sharing\External\MountProvider;
use OCP\Files\Mount\IMountManager;
use OCP\Files\Storage\IStorage;
use OCP\Files\Storage\IStorageFactory;
use OCP\Files\StorageInvalidException;
Expand All @@ -44,7 +48,11 @@ class PollIncomingShares extends Command {
/** @var IStorageFactory */
private $loader;

/** @var Manager */
private $externalManager;

/** @var MountProvider | null */

private $externalMountProvider;

/**
Expand All @@ -55,11 +63,12 @@ class PollIncomingShares extends Command {
* @param MountProvider $externalMountProvider
* @param IStorageFactory $loader
*/
public function __construct(IDBConnection $dbConnection, IUserManager $userManager, IStorageFactory $loader, MountProvider $externalMountProvider = null) {
public function __construct(IDBConnection $dbConnection, IUserManager $userManager, IStorageFactory $loader, Manager $externalManager = null, MountProvider $externalMountProvider = null) {
parent::__construct();
$this->dbConnection = $dbConnection;
$this->userManager = $userManager;
$this->loader = $loader;
$this->externalManager = $externalManager;
$this->externalMountProvider = $externalMountProvider;
}

Expand All @@ -82,16 +91,36 @@ public function execute(InputInterface $input, OutputInterface $output) {
$cursor = $this->getCursor();
while ($data = $cursor->fetch()) {
$user = $this->userManager->get($data['user']);
if ($user === null) {
$output->writeln(
"Skipping user \"{$data['user']}\". Reason: user manager was unable to resolve the uid into the user object"
);
continue;
}

$userMounts = $this->externalMountProvider->getMountsForUser($user, $this->loader);
/** @var \OCA\Files_Sharing\External\Mount $mount */
foreach ($userMounts as $mount) {
try {
/** @var Storage $storage */
$storage = $mount->getStorage();
$this->refreshStorageRoot($storage);
} catch (NoUserException $e) {
$shareData = $this->getExternalShareData($data['user'], $mount->getMountPoint());
$entryId = $shareData['id'];
$remote = $shareData['remote'];
// uid was null so we need to set it
$this->externalManager->setUid($data['user']);
$this->externalManager->removeShare($mount->getMountPoint());
// and now we need to reset uid back to null
$this->externalManager->setUid(null);
$output->writeln(
"Remote \"$remote\" reports that external share with id \"$entryId\" no longer exists. Removing it.."
);
} catch (\Exception $e) {
$entryId = $this->getExternalShareId($data['user'], $mount->getMountPoint());
$remote = $storage->getRemote();
$shareData = $this->getExternalShareData($data['user'], $mount->getMountPoint());
$entryId = $shareData['id'];
$remote = $shareData['remote'];
$reason = $e->getMessage();
$output->writeln(
"Skipping external share with id \"$entryId\" from remote \"$remote\". Reason: \"$reason\""
Expand Down Expand Up @@ -130,13 +159,13 @@ protected function getCursor() {
return $qb->execute();
}

protected function getExternalShareId(string $userId, string $mountPoint) {
protected function getExternalShareData(string $userId, string $mountPoint) {
$relativeMountPoint =\rtrim(
\substr($mountPoint, \strlen("/$userId/files")),
'/'
);
$qb = $this->dbConnection->getQueryBuilder();
$qb->selectDistinct('id')
$qb->select('*')
->from('share_external')
->where(
$qb->expr()->eq('user',
Expand All @@ -148,6 +177,6 @@ protected function getExternalShareId(string $userId, string $mountPoint) {
));
$result = $qb->execute();
$externalShare = $result->fetch();
return $externalShare['id'] ?? 0;
return $externalShare;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ public function createShare() {
);
}
// FIXME this should be a method in the user management instead
\OCP\Util::writeLog('files_sharing', 'shareWith before, ' . $shareWith, \OCP\Util::DEBUG);
\OCP\Util::writeLog('federatedfilesharing', 'shareWith before, ' . $shareWith, \OCP\Util::DEBUG);
\OCP\Util::emitHook(
'\OCA\Files_Sharing\API\Server2Server',
'preLoginNameUsedAsUserName',
['uid' => &$shareWith]
);
\OCP\Util::writeLog('files_sharing', 'shareWith after, ' . $shareWith, \OCP\Util::DEBUG);
\OCP\Util::writeLog('federatedfilesharing', 'shareWith after, ' . $shareWith, \OCP\Util::DEBUG);
if (!$this->userManager->userExists($shareWith)) {
throw new BadRequestException('User does not exist');
}
Expand Down Expand Up @@ -164,7 +164,7 @@ public function createShare() {
);
} catch (\Exception $e) {
\OCP\Util::writeLog(
'files_sharing',
'federatedfilesharing',
'server can not add remote share, ' . $e->getMessage(),
\OCP\Util::ERROR
);
Expand Down
33 changes: 18 additions & 15 deletions apps/federatedfilesharing/lib/FedShareManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ public function createShare(Address $ownerAddress,
$token
) {
$owner = $ownerAddress->getUserId();
$remote = $ownerAddress->getOrigin();
$shareId = $this->federatedShareProvider->addShare(
$ownerAddress->getOrigin(), $token, $name, $owner, $shareWith, $remoteId
$remote, $token, $name, $owner, $shareWith, $remoteId
);

$this->eventDispatcher->dispatch(
Expand Down Expand Up @@ -163,20 +164,22 @@ public function createShare(Address $ownerAddress,
$sharedByAddress->getCloudId(),
\trim($name, '/')
];
$notification = $this->createNotification($shareWith);
$notification->setDateTime(new \DateTime())
->setObject('remote_share', $shareId)
->setSubject('remote_share', $params)
->setMessage('remote_share', $params);
$declineAction = $notification->createAction();
$declineAction->setLabel('decline')
->setLink($link, 'DELETE');
$notification->addAction($declineAction);
$acceptAction = $notification->createAction();
$acceptAction->setLabel('accept')
->setLink($link, 'POST');
$notification->addAction($acceptAction);
$this->notificationManager->notify($notification);
if (!$this->federatedShareProvider->getAccepted($remote, $shareWith)) {
$notification = $this->createNotification($shareWith);
$notification->setDateTime(new \DateTime())
->setObject('remote_share', $shareId)
->setSubject('remote_share', $params)
->setMessage('remote_share', $params);
$declineAction = $notification->createAction();
$declineAction->setLabel('decline')
->setLink($link, 'DELETE');
$notification->addAction($declineAction);
$acceptAction = $notification->createAction();
$acceptAction->setLabel('accept')
->setLink($link, 'POST');
$notification->addAction($acceptAction);
$this->notificationManager->notify($notification);
}
}

/**
Expand Down
Loading