diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index f4aeef11a..3941d9b0f 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -631,19 +631,7 @@ void ownCloudGui::slotShowShareDialog(const QString &sharePath, const QString &l } } - // As a first approximation, set the set of permissions that can be granted - // either to everything (resharing allowed) or nothing (no resharing). - // - // The correct value will be found with a propfind from ShareDialog. - // (we want to show the dialog directly, not wait for the propfind first) - SharePermissions maxSharingPermissions = - SharePermissionRead - | SharePermissionUpdate | SharePermissionCreate | SharePermissionDelete - | SharePermissionShare; - if (!resharingAllowed) { - maxSharingPermissions = {}; - } - + auto maxSharingPermissions = resharingAllowed? SharePermissions(accountState->account()->capabilities().shareDefaultPermissions()) : SharePermissions({}); ShareDialog *w = nullptr; if (_shareDialogs.contains(localPath) && _shareDialogs[localPath]) { diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp index ce28fbb64..1ca12736b 100644 --- a/src/gui/shareusergroupwidget.cpp +++ b/src/gui/shareusergroupwidget.cpp @@ -402,11 +402,8 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index) } } - // Default permissions on creation - int permissions = SharePermissionCreate | SharePermissionUpdate - | SharePermissionDelete | SharePermissionShare; _manager->createShare(_sharePath, Share::ShareType(sharee->type()), - sharee->shareWith(), SharePermission(permissions), password); + sharee->shareWith(), _maxSharingPermissions, password); } _ui->shareeLineEdit->setEnabled(false); diff --git a/src/libsync/capabilities.cpp b/src/libsync/capabilities.cpp index 9983821ae..7eabe70dc 100644 --- a/src/libsync/capabilities.cpp +++ b/src/libsync/capabilities.cpp @@ -100,6 +100,15 @@ bool Capabilities::shareResharing() const return _capabilities["files_sharing"].toMap()["resharing"].toBool(); } +int Capabilities::shareDefaultPermissions() const +{ + if(_capabilities["files_sharing"].toMap().contains("default_permissions")) { + return _capabilities["files_sharing"].toMap()["default_permissions"].toInt(); + } + + return {}; +} + bool Capabilities::clientSideEncryptionAvailable() const { auto it = _capabilities.constFind(QStringLiteral("end-to-end-encryption")); diff --git a/src/libsync/capabilities.h b/src/libsync/capabilities.h index 3040db890..8e0c900ab 100644 --- a/src/libsync/capabilities.h +++ b/src/libsync/capabilities.h @@ -57,6 +57,7 @@ public: int sharePublicLinkExpireDateDays() const; bool sharePublicLinkMultiple() const; bool shareResharing() const; + int shareDefaultPermissions() const; bool chunkingNg() const; bool userStatusNotification() const; bool userStatus() const;