Fix allow reshare for owner when sharing with self through group

This commit is contained in:
Vincent Petry 2015-09-15 15:47:45 +02:00
parent 996639f4fb
commit f439c07ba9
2 changed files with 22 additions and 2 deletions

View file

@ -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;
}
});

View file

@ -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]);
});
});