From 1615312bf1044dcbd98c7e4739467314ada618cf Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 1 Dec 2017 11:35:01 +0100 Subject: add share permissions to settings page Signed-off-by: Bjoern Schiessle --- core/js/shareitemmodel.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'core') diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index b699513c734..e7824aca33a 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -158,23 +158,24 @@ var shareType = attributes.shareType; attributes = _.extend({}, attributes); - // Default permissions are Edit (CRUD) and Share - // Check if these permissions are possible - var permissions = OC.PERMISSION_READ; + // get default permissions + var defaultPermissions = OC.getCapabilities()['files_sharing']['default_permissions'] || OC.PERMISSION_ALL; + var possiblePermissions = OC.PERMISSION_READ; + if (this.updatePermissionPossible()) { - permissions = permissions | OC.PERMISSION_UPDATE; + possiblePermissions = possiblePermissions | OC.PERMISSION_UPDATE; } if (this.createPermissionPossible()) { - permissions = permissions | OC.PERMISSION_CREATE; + possiblePermissions = possiblePermissions | OC.PERMISSION_CREATE; } if (this.deletePermissionPossible()) { - permissions = permissions | OC.PERMISSION_DELETE; + possiblePermissions = possiblePermissions | OC.PERMISSION_DELETE; } if (this.configModel.get('isResharingAllowed') && (this.sharePermissionPossible())) { - permissions = permissions | OC.PERMISSION_SHARE; + possiblePermissions = possiblePermissions | OC.PERMISSION_SHARE; } - attributes.permissions = permissions; + attributes.permissions = defaultPermissions & possiblePermissions; if (_.isUndefined(attributes.path)) { attributes.path = this.fileInfoModel.getFullPath(); } -- cgit v1.2.3