mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Check server capabilities for file sharing default permissions.
Signed-off-by: Camila <hello@camila.codes>
This commit is contained in:
parent
c521ca0949
commit
8f847906c6
4 changed files with 12 additions and 17 deletions
|
@ -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]) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue