Share with circles

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2019-03-05 18:52:54 +01:00
parent a842fd6d26
commit ed3991b7bd
12 changed files with 155 additions and 7 deletions

View File

@@ -20,7 +20,7 @@
*
*/
import app from '../app/App.js';
/* global app OC */
/* global app OC angular */
app.factory('BoardService', function (ApiService, $http, $q) {
var BoardService = function ($http, ep, $q) {
ApiService.call(this, $http, ep, $q);
@@ -59,7 +59,7 @@ app.factory('BoardService', function (ApiService, $http, $q) {
var searchData = {
format: 'json',
perPage: 4,
itemType: [0, 1]
itemType: [0, 1, 7]
};
if (search !== "") {
searchData.search = search;
@@ -79,6 +79,7 @@ app.factory('BoardService', function (ApiService, $http, $q) {
var users = response.ocs.data.exact.users.concat(response.ocs.data.users.slice(0, 4));
var groups = response.ocs.data.exact.groups.concat(response.ocs.data.groups.slice(0, 4));
var circles = response.ocs.data.exact.groups.concat(response.ocs.data.circles.slice(0, 4));
// filter out everyone who is already in the share list
angular.forEach(users, function (item) {
@@ -105,6 +106,18 @@ app.factory('BoardService', function (ApiService, $http, $q) {
self.sharees.push(acl);
}
});
angular.forEach(circles, function (item) {
var acl = self.generateAcl(OC.Share.SHARE_TYPE_CIRCLE, item);
var exists = false;
angular.forEach(self.getCurrent().acl, function (acl) {
if (acl.participant.primaryKey === item.value.shareWith) {
exists = true;
}
});
if (!exists) {
self.sharees.push(acl);
}
});
deferred.resolve(self.sharees);
}, function () {