From f95fea986636ed51deeb1f8d3e4060d9e7ae2db8 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 16 Oct 2015 08:09:57 +0200 Subject: [PATCH] Move permissions to OcsShareJob --- src/gui/ocssharejob.h | 12 ++++++++++++ src/gui/sharedialog.cpp | 13 +++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/gui/ocssharejob.h b/src/gui/ocssharejob.h index 135481bfc..5156a52ad 100644 --- a/src/gui/ocssharejob.h +++ b/src/gui/ocssharejob.h @@ -39,6 +39,18 @@ public: LINK = 3 }; + /** + * Possible permissions + */ + enum class PERMISSION : int { + READ = 1, + UPDATE = 2, + CREATE = 4, + DELETE = 8, + SHARE = 16, + ALL = 31 + }; + /** * Constructor for new shares or listing of shares */ diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp index 5049d4e25..8be6bf008 100644 --- a/src/gui/sharedialog.cpp +++ b/src/gui/sharedialog.cpp @@ -32,15 +32,6 @@ #include #include -namespace { -// int PERMISSION_READ = 1; - int PERMISSION_UPDATE = 2; - int PERMISSION_CREATE = 4; -// int PERMISSION_DELETE = 8; -// int PERMISSION_SHARE = 16; -// int PERMISSION_ALL = 31; -} - namespace OCC { ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QString &localPath, bool resharingAllowed, QWidget *parent) : @@ -348,7 +339,9 @@ void ShareDialog::slotSharesFetched(const QVariantMap &reply) * Only directories can have public upload set * For public links the server sets CREATE and UPDATE permissions. */ - if (!_isFile && (permissions & PERMISSION_UPDATE) && (permissions & PERMISSION_CREATE)) { + if (!_isFile && + (permissions & static_cast(OcsShareJob::PERMISSION::UPDATE)) && + (permissions & static_cast(OcsShareJob::PERMISSION::CREATE))) { _ui->checkBox_editing->setChecked(true); } }