summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-09-15 15:47:45 +0200
committerVincent Petry <pvince81@owncloud.com>2015-09-16 07:23:29 +0200
commitf439c07ba9e76d0baebc7ec3000ee5bc5bc3c675 (patch)
treefc9da90cd28ef05f005ccca2211e3311abe083b5 /core
parent996639f4fbd4107851efc11ee34b24cead43e790 (diff)
downloadnextcloud-server-f439c07ba9e76d0baebc7ec3000ee5bc5bc3c675.tar.gz
nextcloud-server-f439c07ba9e76d0baebc7ec3000ee5bc5bc3c675.zip
Fix allow reshare for owner when sharing with self through group
Diffstat (limited to 'core')
-rw-r--r--core/js/shareitemmodel.js22
-rw-r--r--core/js/tests/specs/shareitemmodelSpec.js2
2 files changed, 22 insertions, 2 deletions
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index e0d44586613..ff0d3a6d800 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -656,7 +656,7 @@
}
var permissions = this.get('possiblePermissions');
- if(!_.isUndefined(data.reshare) && !_.isUndefined(data.reshare.permissions)) {
+ if(!_.isUndefined(data.reshare) && !_.isUndefined(data.reshare.permissions) && data.reshare.uid_owner !== OC.currentUser) {
permissions = permissions & data.reshare.permissions;
}
@@ -723,6 +723,26 @@
permissions: permissions,
allowPublicUploadStatus: allowPublicUploadStatus
};
+ },
+
+ /**
+ * Parses a string to an valid integer (unix timestamp)
+ * @param time
+ * @returns {*}
+ * @internal Only used to work around a bug in the backend
+ */
+ _parseTime: function(time) {
+ if (_.isString(time)) {
+ // skip empty strings and hex values
+ if (time === '' || (time.length > 1 && time[0] === '0' && time[1] === 'x')) {
+ return null;
+ }
+ time = parseInt(time, 10);
+ if(isNaN(time)) {
+ time = null;
+ }
+ }
+ return time;
}
});
diff --git a/core/js/tests/specs/shareitemmodelSpec.js b/core/js/tests/specs/shareitemmodelSpec.js
index 2f676a4ba1f..c1d820052e2 100644
--- a/core/js/tests/specs/shareitemmodelSpec.js
+++ b/core/js/tests/specs/shareitemmodelSpec.js
@@ -274,7 +274,7 @@ describe('OC.Share.ShareItemModel', function() {
['0x12345', null],
[ '', null],
], function(value) {
- expect(OC.Share._parseTime(value[0])).toEqual(value[1]);
+ expect(OC.Share.ShareItemModel.prototype._parseTime(value[0])).toEqual(value[1]);
});
});