Check server capabilities for file sharing default permissions.

Signed-off-by: Camila <hello@camila.codes>
This commit is contained in:
Camila 2021-08-24 14:47:36 +02:00 committed by Matthieu Gallien (Rebase PR Action)
parent c521ca0949
commit 8f847906c6
4 changed files with 12 additions and 17 deletions

View file

@ -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]) {

View file

@ -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);

View file

@ -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"));

View file

@ -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;