From: Camila Date: Tue, 7 Jul 2020 18:40:51 +0000 (+0200) Subject: Display the correct default permissions when creating a share. X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~94^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d7a13672923a638ed53871a4d61c76a33b701b06;p=nextcloud-desktop.git Display the correct default permissions when creating a share. - The default displayed was not in sync with the server because the client was setting permissions when creating a share while it should get the default permissions from the server to display it to the user first. Signed-off-by: Camila --- diff --git a/src/gui/ocssharejob.cpp b/src/gui/ocssharejob.cpp index 489508455..eb651633d 100644 --- a/src/gui/ocssharejob.cpp +++ b/src/gui/ocssharejob.cpp @@ -149,9 +149,6 @@ void OcsShareJob::createShare(const QString &path, addParam(QString::fromLatin1("path"), path); addParam(QString::fromLatin1("shareType"), QString::number(shareType)); addParam(QString::fromLatin1("shareWith"), shareWith); - if (!(permissions & SharePermissionDefault)) { - addParam(QString::fromLatin1("permissions"), QString::number(permissions)); - } start(); } diff --git a/src/gui/sharepermissions.h b/src/gui/sharepermissions.h index 5d1245912..3ac6d3a29 100644 --- a/src/gui/sharepermissions.h +++ b/src/gui/sharepermissions.h @@ -28,7 +28,7 @@ enum SharePermission { SharePermissionCreate = 4, SharePermissionDelete = 8, SharePermissionShare = 16, - SharePermissionDefault = 1 << 30 + SharePermissionDefault = 31 }; Q_DECLARE_FLAGS(SharePermissions, SharePermission) Q_DECLARE_OPERATORS_FOR_FLAGS(SharePermissions) diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp index 41dc21808..8627d3f32 100644 --- a/src/gui/shareusergroupwidget.cpp +++ b/src/gui/shareusergroupwidget.cpp @@ -208,7 +208,7 @@ void ShareUserGroupWidget::slotSharesFetched(const QList> } // the owner of the file that shared it first - // leave out if it's the current user + // leave out if it's the current user if(x == 0 && !share->getUidOwner().isEmpty() && !(share->getUidOwner() == _account->credentials()->user())) { _ui->mainOwnerLabel->setText(QString("Shared with you by ").append(share->getOwnerDisplayName())); } @@ -320,7 +320,8 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index) } else { // Default permissions on creation - int permissions = SharePermissionRead | SharePermissionUpdate; + int permissions = SharePermissionCreate | SharePermissionUpdate + | SharePermissionDelete | SharePermissionShare; _manager->createShare(_sharePath, Share::ShareType(sharee->type()), sharee->shareWith(), SharePermission(permissions)); }