Parse share owner from Webdav to display in UI

This commit is contained in:
Vincent Petry 2015-11-02 15:27:58 +01:00 committed by Lukas Reschke
parent dc8ce87a26
commit 21da6271a8
1 changed files with 21 additions and 1 deletions

View File

@ -50,7 +50,7 @@
if (fileData.shareOwner) { if (fileData.shareOwner) {
tr.attr('data-share-owner', fileData.shareOwner); tr.attr('data-share-owner', fileData.shareOwner);
// user should always be able to rename a mount point // user should always be able to rename a mount point
if (fileData.isShareMountPoint) { if (fileData.mountType === 'shared-root') {
tr.attr('data-permissions', fileData.permissions | OC.PERMISSION_UPDATE); tr.attr('data-permissions', fileData.permissions | OC.PERMISSION_UPDATE);
} }
} }
@ -68,6 +68,26 @@
return fileInfo; return fileInfo;
}; };
var NS_OC = 'http://owncloud.org/ns';
var oldGetWebdavProperties = fileList._getWebdavProperties;
fileList._getWebdavProperties = function() {
var props = oldGetWebdavProperties.apply(this, arguments);
props.push('{' + NS_OC + '}owner-display-name');
return props;
};
fileList.filesClient.addFileInfoParser(function(response) {
var data = {};
var props = response.propStat[0].properties;
var permissionsProp = props['{' + NS_OC + '}permissions'];
if (permissionsProp && permissionsProp.indexOf('S') >= 0) {
data.shareOwner = props['{' + NS_OC + '}owner-display-name'];
}
return data;
});
// use delegate to catch the case with multiple file lists // use delegate to catch the case with multiple file lists
fileList.$el.on('fileActionsReady', function(ev){ fileList.$el.on('fileActionsReady', function(ev){
var fileList = ev.fileList; var fileList = ev.fileList;