diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-07-11 21:44:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-11 21:44:48 +0200 |
commit | 3036b1d03d93267ff7fdda7a1e0682173aec2b98 (patch) | |
tree | 8aeaf29d54d3f508071885b5791b2af96c04f2f0 /core/js | |
parent | a89f9a238f873aab524ba985ed5f3a342ff877f6 (diff) | |
parent | 412f6a6eccd7b4b955d63922150dbe2104cd269d (diff) | |
download | nextcloud-server-3036b1d03d93267ff7fdda7a1e0682173aec2b98.tar.gz nextcloud-server-3036b1d03d93267ff7fdda7a1e0682173aec2b98.zip |
Merge pull request #9895 from nextcloud/fed-group-shares
implement federated group sharing
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/share.js | 1 | ||||
-rw-r--r-- | core/js/sharedialogshareelistview.js | 8 | ||||
-rw-r--r-- | core/js/sharedialogview.js | 26 | ||||
-rw-r--r-- | core/js/tests/specs/sharedialogviewSpec.js | 106 |
4 files changed, 112 insertions, 29 deletions
diff --git a/core/js/share.js b/core/js/share.js index f301de25415..e4d9364b2d1 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -11,6 +11,7 @@ OC.Share = _.extend(OC.Share || {}, { SHARE_TYPE_REMOTE:6, SHARE_TYPE_CIRCLE:7, SHARE_TYPE_GUEST:8, + SHARE_TYPE_REMOTE_GROUP:9, /** * Regular expression for splitting parts of remote share owners: diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js index 1e873a7208e..0ff4c36b712 100644 --- a/core/js/sharedialogshareelistview.js +++ b/core/js/sharedialogshareelistview.js @@ -198,6 +198,8 @@ shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'group') + ')'; } else if (shareType === OC.Share.SHARE_TYPE_REMOTE) { shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'remote') + ')'; + } else if (shareType === OC.Share.SHARE_TYPE_REMOTE_GROUP) { + shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'remote group') + ')'; } else if (shareType === OC.Share.SHARE_TYPE_EMAIL) { shareWithDisplayName = shareWithDisplayName + " (" + t('core', 'email') + ')'; } else if (shareType === OC.Share.SHARE_TYPE_CIRCLE) { @@ -207,7 +209,10 @@ shareWithTitle = shareWith + " (" + t('core', 'group') + ')'; } else if (shareType === OC.Share.SHARE_TYPE_REMOTE) { shareWithTitle = shareWith + " (" + t('core', 'remote') + ')'; - } else if (shareType === OC.Share.SHARE_TYPE_EMAIL) { + } else if (shareType === OC.Share.SHARE_TYPE_REMOTE_GROUP) { + shareWithTitle = shareWith + " (" + t('core', 'remote group') + ')'; + } + else if (shareType === OC.Share.SHARE_TYPE_EMAIL) { shareWithTitle = shareWith + " (" + t('core', 'email') + ')'; } else if (shareType === OC.Share.SHARE_TYPE_CIRCLE) { shareWithTitle = shareWith; @@ -243,6 +248,7 @@ shareId: this.model.get('shares')[shareIndex].id, modSeed: shareType !== OC.Share.SHARE_TYPE_USER && shareType !== OC.Share.SHARE_TYPE_CIRCLE, isRemoteShare: shareType === OC.Share.SHARE_TYPE_REMOTE, + isRemoteGroupShare: shareType === OC.Share.SHARE_TYPE_REMOTE_GROUP, isMailShare: shareType === OC.Share.SHARE_TYPE_EMAIL, isCircleShare: shareType === OC.Share.SHARE_TYPE_CIRCLE, isFileSharedByMail: shareType === OC.Share.SHARE_TYPE_EMAIL && !this.model.isFolder(), diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index dede768fad5..d886e45856f 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -93,6 +93,9 @@ this.configModel.on('change:isRemoteShareAllowed', function() { view.render(); }); + this.configModel.on('change:isRemoteGroupShareAllowed', function() { + view.render(); + }); this.model.on('change:permissions', function() { view.render(); }); @@ -161,7 +164,7 @@ }, function (result) { if (result.ocs.meta.statuscode === 100) { - var filter = function(users, groups, remotes, emails, circles) { + var filter = function(users, groups, remotes, remote_groups, emails, circles) { if (typeof(emails) === 'undefined') { emails = []; } @@ -172,6 +175,7 @@ var usersLength; var groupsLength; var remotesLength; + var remoteGroupsLength; var emailsLength; var circlesLength; @@ -228,6 +232,14 @@ break; } } + } else if (share.share_type === OC.Share.SHARE_TYPE_REMOTE_GROUP) { + remoteGroupsLength = remote_groups.length; + for (j = 0; j < remoteGroupsLength; j++) { + if (remote_groups[j].value.shareWith === share.share_with) { + remote_groups.splice(j, 1); + break; + } + } } else if (share.share_type === OC.Share.SHARE_TYPE_EMAIL) { emailsLength = emails.length; for (j = 0; j < emailsLength; j++) { @@ -252,6 +264,7 @@ result.ocs.data.exact.users, result.ocs.data.exact.groups, result.ocs.data.exact.remotes, + result.ocs.data.exact.remote_groups, result.ocs.data.exact.emails, result.ocs.data.exact.circles ); @@ -259,6 +272,7 @@ var exactUsers = result.ocs.data.exact.users; var exactGroups = result.ocs.data.exact.groups; var exactRemotes = result.ocs.data.exact.remotes; + var exactRemoteGroups = result.ocs.data.exact.remote_groups; var exactEmails = []; if (typeof(result.ocs.data.emails) !== 'undefined') { exactEmails = result.ocs.data.exact.emails; @@ -268,12 +282,13 @@ exactCircles = result.ocs.data.exact.circles; } - var exactMatches = exactUsers.concat(exactGroups).concat(exactRemotes).concat(exactEmails).concat(exactCircles); + var exactMatches = exactUsers.concat(exactGroups).concat(exactRemotes).concat(exactRemoteGroups).concat(exactEmails).concat(exactCircles); filter( result.ocs.data.users, result.ocs.data.groups, result.ocs.data.remotes, + result.ocs.data.remote_groups, result.ocs.data.emails, result.ocs.data.circles ); @@ -281,6 +296,7 @@ var users = result.ocs.data.users; var groups = result.ocs.data.groups; var remotes = result.ocs.data.remotes; + var remoteGroups = result.ocs.data.remote_groups; var lookup = result.ocs.data.lookup; var emails = []; if (typeof(result.ocs.data.emails) !== 'undefined') { @@ -291,7 +307,7 @@ circles = result.ocs.data.circles; } - var suggestions = exactMatches.concat(users).concat(groups).concat(remotes).concat(emails).concat(circles).concat(lookup); + var suggestions = exactMatches.concat(users).concat(groups).concat(remotes).concat(remoteGroups).concat(emails).concat(circles).concat(lookup); deferred.resolve(suggestions, exactMatches); } else { @@ -414,7 +430,9 @@ if (item.value.shareType === OC.Share.SHARE_TYPE_GROUP) { text = t('core', '{sharee} (group)', { sharee: text }, undefined, { escape: false }); } else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE) { - text = t('core', '{sharee} (remote)', { sharee: text }, undefined, { escape: false }); + text = t('core', '{sharee} (remote)', {sharee: text}, undefined, {escape: false}); + } else if (item.value.shareType === OC.Share.SHARE_TYPE_REMOTE_GROUP) { + text = t('core', '{sharee} (remote group)', { sharee: text }, undefined, { escape: false }); } else if (item.value.shareType === OC.Share.SHARE_TYPE_EMAIL) { text = t('core', '{sharee} (email)', { sharee: text }, undefined, { escape: false }); } else if (item.value.shareType === OC.Share.SHARE_TYPE_CIRCLE) { diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js index d3639159849..83c89053202 100644 --- a/core/js/tests/specs/sharedialogviewSpec.js +++ b/core/js/tests/specs/sharedialogviewSpec.js @@ -489,11 +489,13 @@ describe('OC.Share.ShareDialogView', function() { 'exact': { 'users': [], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -529,7 +531,8 @@ describe('OC.Share.ShareDialogView', function() { 'exact': { 'users': [], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [ { @@ -542,6 +545,7 @@ describe('OC.Share.ShareDialogView', function() { ], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -589,11 +593,13 @@ describe('OC.Share.ShareDialogView', function() { } ], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -651,7 +657,8 @@ describe('OC.Share.ShareDialogView', function() { } } ], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [ { @@ -679,6 +686,7 @@ describe('OC.Share.ShareDialogView', function() { } ], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -744,11 +752,13 @@ describe('OC.Share.ShareDialogView', function() { } ], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -817,11 +827,13 @@ describe('OC.Share.ShareDialogView', function() { } ], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -928,7 +940,8 @@ describe('OC.Share.ShareDialogView', function() { } ], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [ { @@ -941,6 +954,7 @@ describe('OC.Share.ShareDialogView', function() { ], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -983,7 +997,8 @@ describe('OC.Share.ShareDialogView', function() { } } ], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [ @@ -996,6 +1011,7 @@ describe('OC.Share.ShareDialogView', function() { } ], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -1038,7 +1054,8 @@ describe('OC.Share.ShareDialogView', function() { 'shareWith': 'foo@bar.com/baz' } } - ] + ], + 'remote_groups': [], }, 'users': [], 'groups': [], @@ -1051,6 +1068,7 @@ describe('OC.Share.ShareDialogView', function() { } } ], + 'remote_groups': [], 'lookup': [] } } @@ -1086,6 +1104,7 @@ describe('OC.Share.ShareDialogView', function() { 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'emails': [ { 'label': 'foo@bar.com', @@ -1099,6 +1118,7 @@ describe('OC.Share.ShareDialogView', function() { 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [], 'emails': [ { @@ -1143,6 +1163,7 @@ describe('OC.Share.ShareDialogView', function() { 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'circles': [ { 'label': 'CircleName (type, owner)', @@ -1163,6 +1184,7 @@ describe('OC.Share.ShareDialogView', function() { 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [], 'circles': [ { @@ -1211,7 +1233,8 @@ describe('OC.Share.ShareDialogView', function() { 'exact': { 'users': [], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [ { @@ -1231,6 +1254,7 @@ describe('OC.Share.ShareDialogView', function() { ], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -1270,7 +1294,8 @@ describe('OC.Share.ShareDialogView', function() { 'exact': { 'users': [], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [ { @@ -1290,6 +1315,7 @@ describe('OC.Share.ShareDialogView', function() { ], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -1364,7 +1390,8 @@ describe('OC.Share.ShareDialogView', function() { 'exact': { 'users': [], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [ { @@ -1384,6 +1411,7 @@ describe('OC.Share.ShareDialogView', function() { ], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -1423,7 +1451,8 @@ describe('OC.Share.ShareDialogView', function() { } ], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [ { @@ -1436,6 +1465,7 @@ describe('OC.Share.ShareDialogView', function() { ], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -1467,7 +1497,8 @@ describe('OC.Share.ShareDialogView', function() { 'exact': { 'users': [], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [ @@ -1487,6 +1518,7 @@ describe('OC.Share.ShareDialogView', function() { } ], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -1526,7 +1558,8 @@ describe('OC.Share.ShareDialogView', function() { } } ], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [ @@ -1539,6 +1572,7 @@ describe('OC.Share.ShareDialogView', function() { } ], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -1570,7 +1604,8 @@ describe('OC.Share.ShareDialogView', function() { 'exact': { 'users': [], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [], @@ -1590,6 +1625,7 @@ describe('OC.Share.ShareDialogView', function() { } } ], + 'remote_groups': [], 'lookup': [] } } @@ -1629,7 +1665,8 @@ describe('OC.Share.ShareDialogView', function() { 'shareWith': 'foo@bar.com/baz' } } - ] + ], + 'remote_groups': [], }, 'users': [], 'groups': [], @@ -1642,6 +1679,7 @@ describe('OC.Share.ShareDialogView', function() { } } ], + 'remote_groups': [], 'lookup': [] } } @@ -1674,12 +1712,14 @@ describe('OC.Share.ShareDialogView', function() { 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'emails': [] }, 'users': [], 'groups': [], 'remotes': [], 'lookup': [], + 'remote_groups': [], 'emails': [ { 'label': 'foo@bar.com', @@ -1727,6 +1767,7 @@ describe('OC.Share.ShareDialogView', function() { 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'emails': [ { 'label': 'foo@bar.com', @@ -1740,6 +1781,7 @@ describe('OC.Share.ShareDialogView', function() { 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [], 'emails': [ { @@ -1781,11 +1823,13 @@ describe('OC.Share.ShareDialogView', function() { 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'circles': [] }, 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [], 'circles': [ { @@ -1834,6 +1878,7 @@ describe('OC.Share.ShareDialogView', function() { 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'circles': [ { 'label': 'CircleName (type, owner)', @@ -1854,6 +1899,7 @@ describe('OC.Share.ShareDialogView', function() { 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [], 'circles': [ { @@ -2031,11 +2077,13 @@ describe('OC.Share.ShareDialogView', function() { 'exact': { 'users': [], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -2126,11 +2174,13 @@ describe('OC.Share.ShareDialogView', function() { } ], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -2191,11 +2241,13 @@ describe('OC.Share.ShareDialogView', function() { } ], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -2248,12 +2300,14 @@ describe('OC.Share.ShareDialogView', function() { 'exact': { 'users': [], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [], 'remotes': [], - 'lookup': [] + 'lookup': [], + 'remote_groups': [], } } }); @@ -2292,7 +2346,8 @@ describe('OC.Share.ShareDialogView', function() { 'exact': { 'users': [], 'groups': [], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [ { @@ -2305,6 +2360,7 @@ describe('OC.Share.ShareDialogView', function() { ], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } @@ -2356,11 +2412,13 @@ describe('OC.Share.ShareDialogView', function() { } } ], - 'remotes': [] + 'remotes': [], + 'remote_groups': [], }, 'users': [], 'groups': [], 'remotes': [], + 'remote_groups': [], 'lookup': [] } } |