Display the correct default permissions when creating a share.
authorCamila <hello@camila.codes>
Tue, 7 Jul 2020 18:40:51 +0000 (20:40 +0200)
committerCamila <hello@camila.codes>
Wed, 8 Jul 2020 16:15:36 +0000 (18:15 +0200)
- 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 <hello@camila.codes>
src/gui/ocssharejob.cpp
src/gui/sharepermissions.h
src/gui/shareusergroupwidget.cpp

index 4895084550b2a71664a8a81f06bf02a693620236..eb651633d931e99e095ce47b8004917a1c33b2e8 100644 (file)
@@ -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();
 }
index 5d1245912fd0f1ff378afcb9e7920baa46473872..3ac6d3a29724ec186993cb67f6247f561138236f 100644 (file)
@@ -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)
index 41dc21808902100ba49ff795ab67c514a4fceea1..8627d3f32d2b8239a269112648b5e53c37e8cd84 100644 (file)
@@ -208,7 +208,7 @@ void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>>
         }
 
         // 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));
     }