From 910c61b4923b645dd3e2d144e37f935913e9f416 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Wed, 30 Mar 2016 11:33:34 +0200 Subject: [PATCH] Disable unavailable sharing permissions #4383 Users can't reshare with more permissions than they have themselves. --- src/gui/ocssharejob.cpp | 2 +- src/gui/ocssharejob.h | 2 +- src/gui/owncloudgui.cpp | 19 +++++- src/gui/share.cpp | 14 ++-- src/gui/share.h | 17 +---- src/gui/sharedialog.cpp | 112 +++++++++++++++++++++---------- src/gui/sharedialog.h | 15 +++-- src/gui/sharelinkwidget.cpp | 6 +- src/gui/sharelinkwidget.h | 5 +- src/gui/sharepermissions.h | 37 ++++++++++ src/gui/shareusergroupwidget.cpp | 57 ++++++++++------ src/gui/shareusergroupwidget.h | 10 ++- 12 files changed, 201 insertions(+), 95 deletions(-) create mode 100644 src/gui/sharepermissions.h diff --git a/src/gui/ocssharejob.cpp b/src/gui/ocssharejob.cpp index 66368aeb9..de3a6753e 100644 --- a/src/gui/ocssharejob.cpp +++ b/src/gui/ocssharejob.cpp @@ -122,7 +122,7 @@ 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 & Share::PermissionDefault)) { + if (!(permissions & SharePermissionDefault)) { addParam(QString::fromLatin1("permissions"), QString::number(permissions)); } diff --git a/src/gui/ocssharejob.h b/src/gui/ocssharejob.h index 36d505ac4..ebf1885e8 100644 --- a/src/gui/ocssharejob.h +++ b/src/gui/ocssharejob.h @@ -101,7 +101,7 @@ public: void createShare(const QString& path, const Share::ShareType shareType, const QString& shareWith = "", - const Share::Permissions permissions = Share::PermissionRead); + const Share::Permissions permissions = SharePermissionRead); /** * Returns information on the items shared with the current user. diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index 4f38015a6..69358835f 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -870,14 +870,27 @@ void ownCloudGui::slotShowShareDialog(const QString &sharePath, const QString &l const auto accountState = folder->accountState(); + // 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 = 0; + } + + ShareDialog *w = 0; if (_shareDialogs.contains(localPath) && _shareDialogs[localPath]) { qDebug() << Q_FUNC_INFO << "Raising share dialog" << sharePath << localPath; w = _shareDialogs[localPath]; } else { - qDebug() << Q_FUNC_INFO << "Opening share dialog" << sharePath << localPath; - w = new ShareDialog(accountState, sharePath, localPath, resharingAllowed); - w->getShares(); + qDebug() << Q_FUNC_INFO << "Opening share dialog" << sharePath << localPath << maxSharingPermissions; + w = new ShareDialog(accountState, sharePath, localPath, maxSharingPermissions); w->setAttribute( Qt::WA_DeleteOnClose, true ); _shareDialogs[localPath] = w; diff --git a/src/gui/share.cpp b/src/gui/share.cpp index 4624b9f10..a72fe7cea 100644 --- a/src/gui/share.cpp +++ b/src/gui/share.cpp @@ -135,8 +135,8 @@ LinkShare::LinkShare(AccountPtr account, bool LinkShare::getPublicUpload() { - return ((_permissions & PermissionUpdate) && - (_permissions & PermissionCreate)); + return ((_permissions & SharePermissionUpdate) && + (_permissions & SharePermissionCreate)); } void LinkShare::setPublicUpload(bool publicUpload) @@ -150,9 +150,9 @@ void LinkShare::setPublicUpload(bool publicUpload) void LinkShare::slotPublicUploadSet(const QVariantMap&, const QVariant &value) { if (value.toBool()) { - _permissions = PermissionRead | PermissionUpdate | PermissionCreate; + _permissions = SharePermissionRead | SharePermissionUpdate | SharePermissionCreate; } else { - _permissions = PermissionRead; + _permissions = SharePermissionRead; } emit publicUploadSet(); @@ -260,7 +260,7 @@ void ShareManager::slotCreateShare(const QVariantMap &reply) _jobContinuation.remove(sender()); // Find existing share permissions (if this was shared with us) - Share::Permissions existingPermissions = Share::PermissionDefault; + Share::Permissions existingPermissions = SharePermissionDefault; foreach (const QVariant & element, reply["ocs"].toMap()["data"].toList()) { QVariantMap map = element.toMap(); if (map["file_target"] == cont.path) @@ -269,9 +269,9 @@ void ShareManager::slotCreateShare(const QVariantMap &reply) // Limit the permissions we request for a share to the ones the item // was shared with initially. - if (cont.permissions == Share::PermissionDefault) { + if (cont.permissions == SharePermissionDefault) { cont.permissions = existingPermissions; - } else if (existingPermissions != Share::PermissionDefault) { + } else if (existingPermissions != SharePermissionDefault) { cont.permissions &= existingPermissions; } diff --git a/src/gui/share.h b/src/gui/share.h index 96f501447..1d2293335 100644 --- a/src/gui/share.h +++ b/src/gui/share.h @@ -16,6 +16,7 @@ #include "accountfwd.h" #include "sharee.h" +#include "sharepermissions.h" #include #include @@ -43,18 +44,7 @@ public: TypeRemote = Sharee::Federated }; - /** - * Possible permissions - */ - enum Permission { - PermissionRead = 1, - PermissionUpdate = 2, - PermissionCreate = 4, - PermissionDelete = 8, - PermissionShare = 16, - PermissionDefault = 1 << 30 - }; - Q_DECLARE_FLAGS(Permissions, Permission) + typedef SharePermissions Permissions; /* * Constructor for shares @@ -63,7 +53,7 @@ public: const QString& id, const QString& path, const ShareType shareType, - const Permissions permissions = PermissionDefault, + const Permissions permissions = SharePermissionDefault, const QSharedPointer shareWith = QSharedPointer(NULL)); /** @@ -208,7 +198,6 @@ private: QDate _expireDate; QUrl _url; }; -Q_DECLARE_OPERATORS_FOR_FLAGS(Share::Permissions) /** * The share manager allows for creating, retrieving and deletion diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp index 51134c279..d677c424d 100644 --- a/src/gui/sharedialog.cpp +++ b/src/gui/sharedialog.cpp @@ -31,15 +31,20 @@ namespace OCC { -ShareDialog::ShareDialog(QPointer accountState, const QString &sharePath, const QString &localPath, bool resharingAllowed, QWidget *parent) : +ShareDialog::ShareDialog(QPointer accountState, + const QString &sharePath, + const QString &localPath, + SharePermissions maxSharingPermissions, + QWidget *parent) : QDialog(parent), _ui(new Ui::ShareDialog), _accountState(accountState), _sharePath(sharePath), _localPath(localPath), - _resharingAllowed(resharingAllowed), + _maxSharingPermissions(maxSharingPermissions), _linkWidget(NULL), - _userGroupWidget(NULL) + _userGroupWidget(NULL), + _progressIndicator(NULL) { setAttribute(Qt::WA_DeleteOnClose); setObjectName("SharingDialog"); // required as group for saveGeometry call @@ -97,32 +102,25 @@ ShareDialog::ShareDialog(QPointer accountState, const QString &sha return; } - auto theme = Theme::instance(); - bool autoShare = true; - - // We only do user/group sharing from 8.2.0 - if (theme->userGroupSharing() && accountState->account()->serverVersionInt() >= ((8 << 16) + (2 << 8))) { - _userGroupWidget = new ShareUserGroupWidget(accountState->account(), sharePath, localPath, resharingAllowed, this); - _ui->shareWidgetsLayout->addWidget(_userGroupWidget); - - - QFrame *hline = new QFrame(this); - hline->setFrameShape(QFrame::HLine); - QPalette p = palette(); - // Make the line softer: - p.setColor(QPalette::Foreground, QColor::fromRgba((p.color(QPalette::Foreground).rgba() & 0x00ffffff) | 0x50000000)); - hline->setPalette(p); - _ui->shareWidgetsLayout->addWidget(hline); - - - autoShare = false; + if (QFileInfo(_localPath).isFile()) { + ThumbnailJob *job = new ThumbnailJob(_sharePath, _accountState->account(), this); + connect(job, SIGNAL(jobFinished(int, QByteArray)), SLOT(slotThumbnailFetched(int, QByteArray))); + job->start(); } - if (theme->linkSharing()) { - _linkWidget = new ShareLinkWidget(accountState->account(), sharePath, localPath, resharingAllowed, autoShare, this); - _linkWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); - _ui->shareWidgetsLayout->addWidget(_linkWidget); - } + _progressIndicator = new QProgressIndicator(this); + _progressIndicator->startAnimation(); + _progressIndicator->setToolTip(tr("Retrieving maximum possible sharing permissions from server...")); + _ui->shareWidgetsLayout->addWidget(_progressIndicator); + + // Server versions >= 9.1 support the "share-permissions" property + // older versions will just return share-permissions: "" + auto job = new PropfindJob(accountState->account(), _sharePath); + job->setProperties(QList() << "http://owncloud.org/ns:share-permissions"); + job->setTimeout(10 * 1000); + connect(job, SIGNAL(result(QVariantMap)), SLOT(slotMaxSharingPermissionsReceived(QVariantMap))); + connect(job, SIGNAL(finishedWithError(QNetworkReply*)), SLOT(slotMaxSharingPermissionsError())); + job->start(); } ShareDialog::~ShareDialog() @@ -136,20 +134,62 @@ void ShareDialog::done( int r ) { QDialog::done(r); } -void ShareDialog::getShares() +void ShareDialog::slotMaxSharingPermissionsReceived(const QVariantMap & result) { - if (QFileInfo(_localPath).isFile()) { - ThumbnailJob *job = new ThumbnailJob(_sharePath, _accountState->account(), this); - connect(job, SIGNAL(jobFinished(int, QByteArray)), SLOT(slotThumbnailFetched(int, QByteArray))); - job->start(); + const QVariant receivedPermissions = result["share-permissions"]; + if (!receivedPermissions.toString().isEmpty()) { + _maxSharingPermissions = static_cast(receivedPermissions.toInt()); + qDebug() << "Received sharing permissions for" << _sharePath << _maxSharingPermissions; } - if (_linkWidget) { - _linkWidget->getShares(); - } - if (_userGroupWidget != NULL) { + showSharingUi(); +} + +void ShareDialog::slotMaxSharingPermissionsError() +{ + // On error show the share ui anyway. The user can still see shares, + // delete them and so on, even though adding new shares or granting + // some of the permissions might fail. + + showSharingUi(); +} + +void ShareDialog::showSharingUi() +{ + _progressIndicator->stopAnimation(); + + auto theme = Theme::instance(); + + // We only do user/group sharing from 8.2.0 + bool userGroupSharing = + theme->userGroupSharing() + && _accountState->account()->serverVersionInt() >= ((8 << 16) + (2 << 8)); + + bool autoShare = !userGroupSharing; + + + if (userGroupSharing) { + _userGroupWidget = new ShareUserGroupWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, this); + _ui->shareWidgetsLayout->addWidget(_userGroupWidget); _userGroupWidget->getShares(); } + + if (theme->linkSharing()) { + if (userGroupSharing) { + QFrame *hline = new QFrame(this); + hline->setFrameShape(QFrame::HLine); + QPalette p = palette(); + // Make the line softer: + p.setColor(QPalette::Foreground, QColor::fromRgba((p.color(QPalette::Foreground).rgba() & 0x00ffffff) | 0x50000000)); + hline->setPalette(p); + _ui->shareWidgetsLayout->addWidget(hline); + } + + _linkWidget = new ShareLinkWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, autoShare, this); + _linkWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); + _ui->shareWidgetsLayout->addWidget(_linkWidget); + _linkWidget->getShares(); + } } void ShareDialog::slotThumbnailFetched(const int &statusCode, const QByteArray &reply) diff --git a/src/gui/sharedialog.h b/src/gui/sharedialog.h index 0a88c6963..b89ba8edb 100644 --- a/src/gui/sharedialog.h +++ b/src/gui/sharedialog.h @@ -15,12 +15,15 @@ #define SHAREDIALOG_H #include "accountstate.h" +#include "sharepermissions.h" #include #include #include #include +class QProgressIndicator; + namespace OCC { namespace Ui { @@ -38,27 +41,31 @@ public: explicit ShareDialog(QPointer accountState, const QString &sharePath, const QString &localPath, - bool resharingAllowed, + SharePermissions maxSharingPermissions, QWidget *parent = 0); ~ShareDialog(); - void getShares(); - private slots: void done( int r ); + void slotMaxSharingPermissionsReceived(const QVariantMap &result); + void slotMaxSharingPermissionsError(); void slotThumbnailFetched(const int &statusCode, const QByteArray &reply); void slotAccountStateChanged(int state); private: + + void showSharingUi(); + Ui::ShareDialog *_ui; QPointer _accountState; QString _sharePath; QString _localPath; - bool _resharingAllowed; + SharePermissions _maxSharingPermissions; ShareLinkWidget *_linkWidget; ShareUserGroupWidget *_userGroupWidget; + QProgressIndicator *_progressIndicator; }; } diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp index 4bb2874d7..5a1fb5562 100644 --- a/src/gui/sharelinkwidget.cpp +++ b/src/gui/sharelinkwidget.cpp @@ -29,7 +29,7 @@ namespace OCC { ShareLinkWidget::ShareLinkWidget(AccountPtr account, const QString &sharePath, const QString &localPath, - bool resharingAllowed, + SharePermissions maxSharingPermissions, bool autoShare, QWidget *parent) : QWidget(parent), @@ -40,7 +40,7 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account, _passwordJobRunning(false), _manager(NULL), _share(NULL), - _resharingAllowed(resharingAllowed), + _maxSharingPermissions(maxSharingPermissions), _autoShare(autoShare), _passwordRequired(false) { @@ -292,7 +292,7 @@ void ShareLinkWidget::slotSharesFetched(const QList> &shar setShareCheckBoxTitle(true); } else { // If its clear that resharing is not allowed, display an error - if( !_resharingAllowed ) { + if( _maxSharingPermissions == 0 ) { displayError(tr("The file can not be shared because it was shared without sharing permission.")); _ui->checkBox_shareLink->setEnabled(false); } else if (_autoShare && _ui->checkBox_shareLink->isEnabled()) { diff --git a/src/gui/sharelinkwidget.h b/src/gui/sharelinkwidget.h index 287d713a3..9a3eea7f5 100644 --- a/src/gui/sharelinkwidget.h +++ b/src/gui/sharelinkwidget.h @@ -16,6 +16,7 @@ #define SHARELINKWIDGET_H #include "accountfwd.h" +#include "sharepermissions.h" #include "QProgressIndicator.h" #include #include @@ -47,7 +48,7 @@ public: explicit ShareLinkWidget(AccountPtr account, const QString &sharePath, const QString &localPath, - bool resharingAllowed, + SharePermissions maxSharingPermissions, bool autoShare = false, QWidget *parent = 0); ~ShareLinkWidget(); @@ -104,7 +105,7 @@ private: ShareManager *_manager; QSharedPointer _share; - bool _resharingAllowed; + SharePermissions _maxSharingPermissions; bool _isFile; bool _autoShare; bool _passwordRequired; diff --git a/src/gui/sharepermissions.h b/src/gui/sharepermissions.h new file mode 100644 index 000000000..02c7a0b05 --- /dev/null +++ b/src/gui/sharepermissions.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) by Roeland Jago Douma + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifndef SHAREPERMISSIONS_H +#define SHAREPERMISSIONS_H + +#include + +namespace OCC { + +/** + * Possible permissions, must match the server permission constants + */ +enum SharePermission { + SharePermissionRead = 1, + SharePermissionUpdate = 2, + SharePermissionCreate = 4, + SharePermissionDelete = 8, + SharePermissionShare = 16, + SharePermissionDefault = 1 << 30 +}; +Q_DECLARE_FLAGS(SharePermissions, SharePermission) +Q_DECLARE_OPERATORS_FOR_FLAGS(SharePermissions) + +} // namespace OCC + +#endif diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp index 01a26f327..441606743 100644 --- a/src/gui/shareusergroupwidget.cpp +++ b/src/gui/shareusergroupwidget.cpp @@ -42,13 +42,17 @@ namespace OCC { -ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, const QString &sharePath, const QString &localPath, bool resharingAllowed, QWidget *parent) : +ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account, + const QString &sharePath, + const QString &localPath, + SharePermissions maxSharingPermissions, + QWidget *parent) : QWidget(parent), _ui(new Ui::ShareUserGroupWidget), _account(account), _sharePath(sharePath), _localPath(localPath), - _resharingAllowed(resharingAllowed), + _maxSharingPermissions(maxSharingPermissions), _disableCompleterActivated(false) { setAttribute(Qt::WA_DeleteOnClose); @@ -178,7 +182,7 @@ void ShareUserGroupWidget::slotSharesFetched(const QList> continue; } - ShareWidget *s = new ShareWidget(share, _isFile, _ui->scrollArea); + ShareWidget *s = new ShareWidget(share, _maxSharingPermissions, _isFile, _ui->scrollArea); connect(s, SIGNAL(resizeRequested()), this, SLOT(slotAdjustScrollWidgetSize())); layout->addWidget(s); @@ -246,15 +250,15 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex & index) * https://github.com/owncloud/core/issues/22122#issuecomment-185637344 */ if (sharee->type() == Sharee::Federated) { - int permissions = Share::PermissionRead | Share::PermissionUpdate; + int permissions = SharePermissionRead | SharePermissionUpdate; if (!_isFile) { - permissions |= Share::PermissionCreate | Share::PermissionDelete; + permissions |= SharePermissionCreate | SharePermissionDelete; } _manager->createShare(_sharePath, Share::ShareType(sharee->type()), - sharee->shareWith(), Share::Permission(permissions)); + sharee->shareWith(), SharePermission(permissions)); } else { _manager->createShare(_sharePath, Share::ShareType(sharee->type()), - sharee->shareWith(), Share::PermissionDefault); + sharee->shareWith(), SharePermissionDefault); } _ui->shareeLineEdit->setEnabled(false); @@ -276,6 +280,7 @@ void ShareUserGroupWidget::displayError(int code, const QString& message) } ShareWidget::ShareWidget(QSharedPointer share, + SharePermissions maxSharingPermissions, bool isFile, QWidget *parent) : QWidget(parent), @@ -291,10 +296,13 @@ ShareWidget::ShareWidget(QSharedPointer share, QMenu *menu = new QMenu(this); _permissionCreate = new QAction(tr("create"), this); _permissionCreate->setCheckable(true); + _permissionCreate->setEnabled(maxSharingPermissions & SharePermissionCreate); _permissionUpdate = new QAction(tr("change"), this); _permissionUpdate->setCheckable(true); + _permissionUpdate->setEnabled(maxSharingPermissions & SharePermissionUpdate); _permissionDelete = new QAction(tr("delete"), this); _permissionDelete->setCheckable(true); + _permissionDelete->setEnabled(maxSharingPermissions & SharePermissionDelete); menu->addAction(_permissionUpdate); /* @@ -313,6 +321,10 @@ ShareWidget::ShareWidget(QSharedPointer share, // Set the permissions checkboxes displayPermissions(); + _ui->permissionShare->setEnabled(maxSharingPermissions & SharePermissionShare); + _ui->permissionsEdit->setEnabled(maxSharingPermissions + & (SharePermissionCreate | SharePermissionUpdate | SharePermissionDelete)); + connect(_permissionUpdate, SIGNAL(triggered(bool)), SLOT(slotPermissionsChanged())); connect(_permissionCreate, SIGNAL(triggered(bool)), SLOT(slotPermissionsChanged())); connect(_permissionDelete, SIGNAL(triggered(bool)), SLOT(slotPermissionsChanged())); @@ -354,21 +366,24 @@ void ShareWidget::slotEditPermissionsChanged() { setEnabled(false); - Share::Permissions permissions = Share::PermissionRead; + Share::Permissions permissions = SharePermissionRead; if (_ui->permissionShare->checkState() == Qt::Checked) { - permissions |= Share::PermissionShare; + permissions |= SharePermissionShare; } if (_ui->permissionsEdit->checkState() == Qt::Checked) { - permissions |= Share::PermissionUpdate; + if (_permissionUpdate->isEnabled()) + permissions |= SharePermissionUpdate; /* * Files can't have create or delete permisisons */ if (!_isFile) { - permissions |= Share::PermissionCreate; - permissions |= Share::PermissionDelete; + if (_permissionCreate->isEnabled()) + permissions |= SharePermissionCreate; + if (_permissionDelete->isEnabled()) + permissions |= SharePermissionDelete; } } @@ -379,22 +394,22 @@ void ShareWidget::slotPermissionsChanged() { setEnabled(false); - Share::Permissions permissions = Share::PermissionRead; + Share::Permissions permissions = SharePermissionRead; if (_permissionUpdate->isChecked()) { - permissions |= Share::PermissionUpdate; + permissions |= SharePermissionUpdate; } if (_permissionCreate->isChecked()) { - permissions |= Share::PermissionCreate; + permissions |= SharePermissionCreate; } if (_permissionDelete->isChecked()) { - permissions |= Share::PermissionDelete; + permissions |= SharePermissionDelete; } if (_ui->permissionShare->checkState() == Qt::Checked) { - permissions |= Share::PermissionShare; + permissions |= SharePermissionShare; } _share->setPermissions(permissions); @@ -444,19 +459,19 @@ void ShareWidget::displayPermissions() _ui->permissionShare->setCheckState(Qt::Unchecked); _permissionUpdate->setChecked(false); - if (_share->getPermissions() & Share::PermissionUpdate) { + if (_share->getPermissions() & SharePermissionUpdate) { _permissionUpdate->setChecked(true); _ui->permissionsEdit->setCheckState(Qt::Checked); } - if (!_isFile && _share->getPermissions() & Share::PermissionCreate) { + if (!_isFile && _share->getPermissions() & SharePermissionCreate) { _permissionCreate->setChecked(true); _ui->permissionsEdit->setCheckState(Qt::Checked); } - if (!_isFile && _share->getPermissions() & Share::PermissionDelete) { + if (!_isFile && _share->getPermissions() & SharePermissionDelete) { _permissionDelete->setChecked(true); _ui->permissionsEdit->setCheckState(Qt::Checked); } - if (_share->getPermissions() & Share::PermissionShare) { + if (_share->getPermissions() & SharePermissionShare) { _ui->permissionShare->setCheckState(Qt::Checked); } } diff --git a/src/gui/shareusergroupwidget.h b/src/gui/shareusergroupwidget.h index cbe226341..2d47fcdfd 100644 --- a/src/gui/shareusergroupwidget.h +++ b/src/gui/shareusergroupwidget.h @@ -15,6 +15,7 @@ #define SHAREUSERGROUPWIDGET_H #include "accountfwd.h" +#include "sharepermissions.h" #include "QProgressIndicator.h" #include #include @@ -48,7 +49,10 @@ class ShareWidget : public QWidget Q_OBJECT public: - explicit ShareWidget(QSharedPointer Share, bool isFile, QWidget *parent = 0); + explicit ShareWidget(QSharedPointer Share, + SharePermissions maxSharingPermissions, + bool isFile, + QWidget *parent = 0); ~ShareWidget(); QSharedPointer share() const; @@ -90,7 +94,7 @@ public: explicit ShareUserGroupWidget(AccountPtr account, const QString &sharePath, const QString &localPath, - bool resharingAllowed, + SharePermissions maxSharingPermissions, QWidget *parent = 0); ~ShareUserGroupWidget(); @@ -121,7 +125,7 @@ private: ShareeModel *_completerModel; QTimer _completionTimer; - bool _resharingAllowed; + SharePermissions _maxSharingPermissions; bool _isFile; bool _disableCompleterActivated; // in order to avoid that we share the contents twice ShareManager *_manager;