4545use OCP \Federation \ICloudFederationShare ;
4646use OCP \Federation \ICloudIdManager ;
4747use OCP \Files \NotFoundException ;
48+ use OCP \IConfig ;
4849use OCP \IDBConnection ;
4950use OCP \IGroupManager ;
5051use OCP \ILogger ;
@@ -101,6 +102,9 @@ class CloudFederationProviderFiles implements ICloudFederationProvider {
101102 /** @var IGroupManager */
102103 private $ groupManager ;
103104
105+ /** @var IConfig */
106+ private $ config ;
107+
104108 /**
105109 * CloudFederationProvider constructor.
106110 *
@@ -132,7 +136,8 @@ public function __construct(IAppManager $appManager,
132136 ICloudFederationFactory $ cloudFederationFactory ,
133137 ICloudFederationProviderManager $ cloudFederationProviderManager ,
134138 IDBConnection $ connection ,
135- IGroupManager $ groupManager
139+ IGroupManager $ groupManager ,
140+ IConfig $ config
136141 ) {
137142 $ this ->appManager = $ appManager ;
138143 $ this ->federatedShareProvider = $ federatedShareProvider ;
@@ -148,6 +153,7 @@ public function __construct(IAppManager $appManager,
148153 $ this ->cloudFederationProviderManager = $ cloudFederationProviderManager ;
149154 $ this ->connection = $ connection ;
150155 $ this ->groupManager = $ groupManager ;
156+ $ this ->config = $ config ;
151157 }
152158
153159
@@ -636,6 +642,11 @@ protected function reshareRequested($id, array $notification) {
636642 $ senderId = $ notification ['senderId ' ];
637643
638644 $ share = $ this ->federatedShareProvider ->getShareById ($ id );
645+
646+ // We have to respect the default share permissions
647+ $ permissions = $ share ->getPermissions () & (int )$ this ->config ->getAppValue ('core ' , 'shareapi_default_permissions ' , (string )Constants::PERMISSION_ALL );
648+ $ share ->setPermissions ($ permissions );
649+
639650 // don't allow to share a file back to the owner
640651 try {
641652 list ($ user , $ remote ) = $ this ->addressHandler ->splitUserRemote ($ shareWith );
0 commit comments