From 21da6271a8656517e956aa8897d8316b6a61ceac Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 2 Nov 2015 15:27:58 +0100 Subject: Parse share owner from Webdav to display in UI --- apps/files_sharing/js/share.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'apps/files_sharing/js') diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 63225a0d8ec..3d105f283d8 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -50,7 +50,7 @@ if (fileData.shareOwner) { tr.attr('data-share-owner', fileData.shareOwner); // 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); } } @@ -68,6 +68,26 @@ 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 fileList.$el.on('fileActionsReady', function(ev){ var fileList = ev.fileList; -- cgit v1.2.3