mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Fix share permission values
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
aec5f09212
commit
c05e1920bb
@ -461,7 +461,7 @@ void ShareManager::createShare(const QString &path,
|
||||
connect(job, &OcsShareJob::shareJobFinished, this,
|
||||
[=](const QJsonDocument &reply) {
|
||||
// Find existing share permissions (if this was shared with us)
|
||||
Share::Permissions existingPermissions = SharePermissionDefault;
|
||||
Share::Permissions existingPermissions = SharePermissionAll;
|
||||
foreach (const QJsonValue &element, reply.object()["ocs"].toObject()["data"].toArray()) {
|
||||
auto map = element.toObject();
|
||||
if (map["file_target"] == path)
|
||||
@ -471,10 +471,10 @@ void ShareManager::createShare(const QString &path,
|
||||
// Limit the permissions we request for a share to the ones the item
|
||||
// was shared with initially.
|
||||
auto validPermissions = desiredPermissions;
|
||||
if (validPermissions == SharePermissionDefault) {
|
||||
if (validPermissions == SharePermissionAll) {
|
||||
validPermissions = existingPermissions;
|
||||
}
|
||||
if (existingPermissions != SharePermissionDefault) {
|
||||
if (existingPermissions != SharePermissionAll) {
|
||||
validPermissions &= existingPermissions;
|
||||
}
|
||||
|
||||
|
||||
@ -71,14 +71,14 @@ public:
|
||||
* Constructor for shares
|
||||
*/
|
||||
explicit Share(AccountPtr account,
|
||||
const QString &id,
|
||||
const QString &owner,
|
||||
const QString &ownerDisplayName,
|
||||
const QString &path,
|
||||
const ShareType shareType,
|
||||
bool isPasswordSet = false,
|
||||
const Permissions permissions = SharePermissionDefault,
|
||||
const ShareePtr shareWith = ShareePtr(nullptr));
|
||||
const QString &id,
|
||||
const QString &owner,
|
||||
const QString &ownerDisplayName,
|
||||
const QString &path,
|
||||
const ShareType shareType,
|
||||
bool isPasswordSet = false,
|
||||
const Permissions permissions = SharePermissionAll,
|
||||
const ShareePtr shareWith = ShareePtr(nullptr));
|
||||
|
||||
/**
|
||||
* The account the share is defined on.
|
||||
|
||||
@ -23,12 +23,12 @@ namespace OCC {
|
||||
* Possible permissions, must match the server permission constants
|
||||
*/
|
||||
enum SharePermission {
|
||||
SharePermissionRead = 1 << 0,
|
||||
SharePermissionUpdate = 1 << 1,
|
||||
SharePermissionCreate = 1 << 2,
|
||||
SharePermissionDelete = 1 << 3,
|
||||
SharePermissionShare = 1 << 4,
|
||||
SharePermissionDefault = 1 << 30
|
||||
SharePermissionRead = 1,
|
||||
SharePermissionUpdate = 1 << 1,
|
||||
SharePermissionCreate = 1 << 2,
|
||||
SharePermissionDelete = 1 << 3,
|
||||
SharePermissionShare = 1 << 4,
|
||||
SharePermissionAll = 31,
|
||||
};
|
||||
Q_DECLARE_FLAGS(SharePermissions, SharePermission)
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(SharePermissions)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user