Apply server default permissions for federated file sharing too.
authorCamila <hello@camila.codes>
Wed, 25 Aug 2021 10:06:42 +0000 (12:06 +0200)
committerMatthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr>
Mon, 27 Sep 2021 08:53:45 +0000 (08:53 +0000)
See nextcloud/server#24729 comments.

Signed-off-by: Camila <hello@camila.codes>
src/gui/shareusergroupwidget.cpp

index 1ca12736b6092c6d631f945a1554ce4105c279b8..45d2c9ec7d7c5facfc184b077f73d60319f68b15 100644 (file)
@@ -371,40 +371,30 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index)
      */
 
     _lastCreatedShareId = QString();
-
-    if (sharee->type() == Sharee::Federated
-        && _account->serverVersionInt() < Account::makeServerVersion(9, 1, 0)) {
-        int permissions = SharePermissionRead | SharePermissionUpdate;
-        if (!_isFile) {
-            permissions |= SharePermissionCreate | SharePermissionDelete;
-        }
-        _manager->createShare(_sharePath, Share::ShareType(sharee->type()),
-            sharee->shareWith(), SharePermission(permissions));
-    } else {
-        QString password;
-        if (sharee->type() == Sharee::Email && _account->capabilities().shareEmailPasswordEnforced()) {
-            _ui->shareeLineEdit->clear();
-            // always show a dialog for password-enforced email shares
-            bool ok = false;
-
-            do {
-                password = QInputDialog::getText(
-                            this,
-                            tr("Password for share required"),
-                            tr("Please enter a password for your email share:"),
-                            QLineEdit::Password,
-                            QString(),
-                            &ok);
-            } while (password.isEmpty() && ok);
-
-            if (!ok) {
-                return;
-            }
+    
+    QString password;
+    if (sharee->type() == Sharee::Email && _account->capabilities().shareEmailPasswordEnforced()) {
+        _ui->shareeLineEdit->clear();
+        // always show a dialog for password-enforced email shares
+        bool ok = false;
+        
+        do {
+            password = QInputDialog::getText(
+                this,
+                tr("Password for share required"),
+                tr("Please enter a password for your email share:"),
+                QLineEdit::Password,
+                QString(),
+                &ok);
+        } while (password.isEmpty() && ok);
+        
+        if (!ok) {
+            return;
         }
-
-        _manager->createShare(_sharePath, Share::ShareType(sharee->type()),
-            sharee->shareWith(), _maxSharingPermissions, password);
     }
+    
+    _manager->createShare(_sharePath, Share::ShareType(sharee->type()),
+        sharee->shareWith(), _maxSharingPermissions, password);
 
     _ui->shareeLineEdit->setEnabled(false);
     _ui->shareeLineEdit->clear();