solid-ui 2.4.23 → 2.4.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/main.js +2159 -5039
  2. package/dist/main.js.map +1 -1
  3. package/lib/acl/access-controller.js +4 -67
  4. package/lib/acl/access-controller.js.map +1 -1
  5. package/lib/acl/access-groups.js +59 -137
  6. package/lib/acl/access-groups.js.map +1 -1
  7. package/lib/acl/acl-control.js +14 -54
  8. package/lib/acl/acl-control.js.map +1 -1
  9. package/lib/acl/acl.js +32 -107
  10. package/lib/acl/acl.js.map +1 -1
  11. package/lib/acl/add-agent-buttons.js +0 -92
  12. package/lib/acl/add-agent-buttons.js.map +1 -1
  13. package/lib/acl/index.js +1 -3
  14. package/lib/acl/index.js.map +1 -1
  15. package/lib/acl/styles.js +1 -2
  16. package/lib/acl/styles.js.map +1 -1
  17. package/lib/chat/bookmarks.js +8 -80
  18. package/lib/chat/bookmarks.js.map +1 -1
  19. package/lib/chat/chatLogic.js +109 -180
  20. package/lib/chat/chatLogic.js.map +1 -1
  21. package/lib/chat/dateFolder.js +6 -91
  22. package/lib/chat/dateFolder.js.map +1 -1
  23. package/lib/chat/infinite.js +33 -185
  24. package/lib/chat/infinite.js.map +1 -1
  25. package/lib/chat/message.js +37 -150
  26. package/lib/chat/message.js.map +1 -1
  27. package/lib/chat/messageTools.js +23 -96
  28. package/lib/chat/messageTools.js.map +1 -1
  29. package/lib/chat/thread.js +33 -91
  30. package/lib/chat/thread.js.map +1 -1
  31. package/lib/create/create.js +19 -51
  32. package/lib/create/create.js.map +1 -1
  33. package/lib/create/index.js +0 -2
  34. package/lib/create/index.js.map +1 -1
  35. package/lib/debug.js +0 -8
  36. package/lib/debug.js.map +1 -1
  37. package/lib/folders.js +4 -27
  38. package/lib/folders.js.map +1 -1
  39. package/lib/footer/index.js +2 -24
  40. package/lib/footer/index.js.map +1 -1
  41. package/lib/footer/styleMap.js.map +1 -1
  42. package/lib/header/empty-profile.js.map +1 -1
  43. package/lib/header/index.js +3 -72
  44. package/lib/header/index.js.map +1 -1
  45. package/lib/header/styleMap.js +4 -3
  46. package/lib/header/styleMap.js.map +1 -1
  47. package/lib/iconBase.js +3 -4
  48. package/lib/iconBase.js.map +1 -1
  49. package/lib/index.js +5 -46
  50. package/lib/index.js.map +1 -1
  51. package/lib/jss/index.js +3 -9
  52. package/lib/jss/index.js.map +1 -1
  53. package/lib/log.js +15 -51
  54. package/lib/log.js.map +1 -1
  55. package/lib/login/login.js +74 -303
  56. package/lib/login/login.js.map +1 -1
  57. package/lib/matrix/index.js +0 -2
  58. package/lib/matrix/index.js.map +1 -1
  59. package/lib/matrix/matrix.js +7 -55
  60. package/lib/matrix/matrix.js.map +1 -1
  61. package/lib/media/index.js +0 -2
  62. package/lib/media/index.js.map +1 -1
  63. package/lib/media/media-capture.js +13 -33
  64. package/lib/media/media-capture.js.map +1 -1
  65. package/lib/messageArea.js +23 -64
  66. package/lib/messageArea.js.map +1 -1
  67. package/lib/noun_Camera_1618446_000000.js.map +1 -1
  68. package/lib/ns.js +5 -7
  69. package/lib/ns.js.map +1 -1
  70. package/lib/pad.js +48 -234
  71. package/lib/pad.js.map +1 -1
  72. package/lib/participation.js +10 -65
  73. package/lib/participation.js.map +1 -1
  74. package/lib/preferences.js +21 -42
  75. package/lib/preferences.js.map +1 -1
  76. package/lib/signup/config-default.js +1 -8
  77. package/lib/signup/config-default.js.map +1 -1
  78. package/lib/signup/signup.js +6 -13
  79. package/lib/signup/signup.js.map +1 -1
  80. package/lib/stories/decorators.js +0 -2
  81. package/lib/stories/decorators.js.map +1 -1
  82. package/lib/style.js +8 -5
  83. package/lib/style.js.map +1 -1
  84. package/lib/style_multiSelect.js +1 -5
  85. package/lib/style_multiSelect.js.map +1 -1
  86. package/lib/table.js +309 -322
  87. package/lib/table.js.map +1 -1
  88. package/lib/tabs.js +20 -100
  89. package/lib/tabs.js.map +1 -1
  90. package/lib/utils/headerFooterHelpers.js +4 -52
  91. package/lib/utils/headerFooterHelpers.js.map +1 -1
  92. package/lib/utils/index.js +41 -135
  93. package/lib/utils/index.js.map +1 -1
  94. package/lib/utils/label.js +13 -34
  95. package/lib/utils/label.js.map +1 -1
  96. package/lib/versionInfo.js +4 -4
  97. package/lib/versionInfo.js.map +1 -1
  98. package/lib/widgets/buttons/iconLinks.js +0 -8
  99. package/lib/widgets/buttons/iconLinks.js.map +1 -1
  100. package/lib/widgets/buttons.js +115 -291
  101. package/lib/widgets/buttons.js.map +1 -1
  102. package/lib/widgets/dragAndDrop.js +12 -41
  103. package/lib/widgets/dragAndDrop.js.map +1 -1
  104. package/lib/widgets/error.js +3 -9
  105. package/lib/widgets/error.js.map +1 -1
  106. package/lib/widgets/forms/autocomplete/autocompleteBar.js +8 -71
  107. package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
  108. package/lib/widgets/forms/autocomplete/autocompleteField.js +13 -65
  109. package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
  110. package/lib/widgets/forms/autocomplete/autocompletePicker.js +15 -107
  111. package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
  112. package/lib/widgets/forms/autocomplete/language.js +6 -55
  113. package/lib/widgets/forms/autocomplete/language.js.map +1 -1
  114. package/lib/widgets/forms/autocomplete/publicData.js +12 -131
  115. package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
  116. package/lib/widgets/forms/basic.js +12 -55
  117. package/lib/widgets/forms/basic.js.map +1 -1
  118. package/lib/widgets/forms/comment.js +1 -15
  119. package/lib/widgets/forms/comment.js.map +1 -1
  120. package/lib/widgets/forms/fieldFunction.js +3 -16
  121. package/lib/widgets/forms/fieldFunction.js.map +1 -1
  122. package/lib/widgets/forms/fieldParams.js +0 -12
  123. package/lib/widgets/forms/fieldParams.js.map +1 -1
  124. package/lib/widgets/forms/formStyle.js +1 -14
  125. package/lib/widgets/forms/formStyle.js.map +1 -1
  126. package/lib/widgets/forms.js +70 -474
  127. package/lib/widgets/forms.js.map +1 -1
  128. package/lib/widgets/index.js +0 -21
  129. package/lib/widgets/index.js.map +1 -1
  130. package/lib/widgets/multiSelect.js +48 -171
  131. package/lib/widgets/multiSelect.js.map +1 -1
  132. package/lib/widgets/peoplePicker.js +20 -90
  133. package/lib/widgets/peoplePicker.js.map +1 -1
  134. package/lib/widgets/widgetHelpers.js +2 -9
  135. package/lib/widgets/widgetHelpers.js.map +1 -1
  136. package/package.json +28 -28
package/lib/acl/acl.js CHANGED
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
@@ -26,39 +24,30 @@ exports.putACLbyCombo = putACLbyCombo;
26
24
  exports.readACL = readACL;
27
25
  exports.sameACL = sameACL;
28
26
  exports.setACL = setACL;
29
-
30
27
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
31
-
32
28
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
33
-
34
29
  var ns = _interopRequireWildcard(require("../ns"));
35
-
36
30
  var _solidLogic = require("solid-logic");
37
-
38
31
  var utils = _interopRequireWildcard(require("../utils"));
39
-
40
32
  var debug = _interopRequireWildcard(require("../debug"));
41
-
42
33
  var _rdflib = require("rdflib");
43
-
44
34
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
45
-
46
35
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
47
-
48
36
  /**
49
37
  * Non-UI functions for access control.
50
38
  * See https://github.com/solidos/web-access-control-spec
51
39
  * for the spec that defines how ACL documents work.
52
40
  * @packageDocumentation
53
41
  */
42
+
54
43
  var kb = _solidLogic.solidLogicSingleton.store;
44
+
55
45
  /**
56
46
  * Take the "default" ACL and convert it into the equivlent ACL
57
47
  * which the resource would have had. Return it as a new separate store.
58
48
  * The "defaultForNew" predicate is also accepted, as a deprecated
59
49
  * synonym for "default".
60
50
  */
61
-
62
51
  function adoptACLDefault(doc, aclDoc, defaultResource, defaultACLDoc) {
63
52
  var ACL = ns.acl;
64
53
  var isContainer = doc.uri.slice(-1) === '/'; // Give default for all directories
@@ -68,25 +57,21 @@ function adoptACLDefault(doc, aclDoc, defaultResource, defaultACLDoc) {
68
57
  return accumulatedStatements.concat(kb.statementsMatching(da, ns.rdf('type'), ACL('Authorization'), defaultACLDoc)).concat(kb.statementsMatching(da, ACL('agent'), undefined, defaultACLDoc)).concat(kb.statementsMatching(da, ACL('agentClass'), undefined, defaultACLDoc)).concat(kb.statementsMatching(da, ACL('agentGroup'), undefined, defaultACLDoc)).concat(kb.statementsMatching(da, ACL('origin'), undefined, defaultACLDoc)).concat(kb.statementsMatching(da, ACL('originClass'), undefined, defaultACLDoc)).concat(kb.statementsMatching(da, ACL('mode'), undefined, defaultACLDoc)).concat((0, _rdflib.st)(da, ACL('accessTo'), doc, defaultACLDoc)).concat(isContainer ? (0, _rdflib.st)(da, ACL('default'), doc, defaultACLDoc) : []);
69
58
  }, []);
70
59
  var kb2 = (0, _rdflib.graph)(); // Potential - derived is kept apart
71
-
72
60
  proposed.forEach(function (st) {
73
61
  return kb2.add(move(st.subject), move(st.predicate), move(st.object), (0, _rdflib.sym)(aclDoc.uri));
74
62
  });
75
63
  return kb2;
76
-
77
64
  function move(symbol) {
78
65
  var y = defaultACLDoc.uri.length; // The default ACL file
79
-
80
66
  return (0, _rdflib.sym)(symbol.uri.slice(0, y) === defaultACLDoc.uri ? aclDoc.uri + symbol.uri.slice(y) : symbol.uri);
81
67
  }
82
68
  }
69
+
83
70
  /**
84
71
  * Read and canonicalize the ACL for x in aclDoc
85
72
  *
86
73
  * Accumulate the access rights which each agent or class has
87
74
  */
88
-
89
-
90
75
  function readACL(doc, aclDoc) {
91
76
  var kb2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : kb;
92
77
  var getDefaults = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
@@ -109,17 +94,16 @@ function readACL(doc, aclDoc) {
109
94
  });
110
95
  });
111
96
  });
112
- return ac;
113
97
 
98
+ return ac;
114
99
  function getDefaultsFallback(kb, ns) {
115
100
  return kb.each(undefined, ns.acl('default'), doc).concat(kb.each(undefined, ns.acl('defaultForNew'), doc));
116
101
  }
117
102
  }
103
+
118
104
  /**
119
105
  * Compare two ACLs
120
106
  */
121
-
122
-
123
107
  function sameACL(a, b) {
124
108
  var contains = function contains(a, b) {
125
109
  for (var pred in {
@@ -139,26 +123,21 @@ function sameACL(a, b) {
139
123
  }
140
124
  }
141
125
  }
142
-
143
126
  return true;
144
127
  };
145
-
146
128
  return contains(a, b) && contains(b, a);
147
129
  }
130
+
148
131
  /**
149
132
  * Union N ACLs
150
133
  */
151
-
152
-
153
134
  function ACLunion(list) {
154
135
  var b = list[0];
155
136
  var a, ag;
156
-
157
137
  var _loop = function _loop(k) {
158
138
  ;
159
139
  ['agent', 'agentClass', 'agentGroup', 'origin', 'originClass'].forEach(function (pred) {
160
140
  a = list[k];
161
-
162
141
  if (a[pred]) {
163
142
  for (ag in a[pred]) {
164
143
  for (var mode in a[pred][ag]) {
@@ -169,20 +148,16 @@ function ACLunion(list) {
169
148
  }
170
149
  });
171
150
  };
172
-
173
151
  for (var k = 1; k < list.length; k++) {
174
152
  _loop(k);
175
153
  }
176
-
177
154
  return b;
178
155
  }
179
-
180
156
  /**
181
157
  * Merge ACLs lists from things to form union
182
158
  */
183
159
  function loadUnionACL(subjectList, callbackFunction) {
184
160
  var aclList = [];
185
-
186
161
  var doList = function doList(list) {
187
162
  if (list.length) {
188
163
  var doc = list.shift().doc();
@@ -198,27 +173,23 @@ function loadUnionACL(subjectList, callbackFunction) {
198
173
  callbackFunction(true, ACLunion(aclList));
199
174
  }
200
175
  };
201
-
202
176
  doList(subjectList);
203
177
  }
178
+
204
179
  /**
205
180
  * Represents these as an RDF graph by combination of modes
206
181
  *
207
182
  * Each agent can only be in one place in this model, one combination of modes.
208
183
  * Combos are like full control, read append, read only etc.
209
184
  */
210
-
211
-
212
185
  function ACLbyCombination(ac) {
213
186
  var byCombo = {};
214
187
  ['agent', 'agentClass', 'agentGroup', 'origin', 'originClass'].forEach(function (pred) {
215
188
  for (var agent in ac[pred]) {
216
189
  var combo = [];
217
-
218
190
  for (var mode in ac[pred][agent]) {
219
191
  combo.push(mode);
220
192
  }
221
-
222
193
  combo.sort();
223
194
  var combo2 = combo.join('\n');
224
195
  if (!byCombo[combo2]) byCombo[combo2] = [];
@@ -227,51 +198,39 @@ function ACLbyCombination(ac) {
227
198
  });
228
199
  return byCombo;
229
200
  }
201
+
230
202
  /**
231
203
  * Write ACL graph to store from AC
232
204
  */
233
-
234
-
235
205
  function makeACLGraph(kb, x, ac, aclDoc) {
236
206
  var byCombo = ACLbyCombination(ac);
237
207
  return makeACLGraphbyCombo(kb, x, byCombo, aclDoc);
238
208
  }
209
+
239
210
  /**
240
211
  * Write ACL graph to store from combo
241
212
  */
242
-
243
-
244
213
  function makeACLGraphbyCombo(kb, x, byCombo, aclDoc, main, defa) {
245
214
  var ACL = ns.acl;
246
-
247
215
  for (var combo in byCombo) {
248
216
  var pairs = byCombo[combo];
249
217
  if (!pairs.length) continue; // do not add to store when no agent
250
-
251
218
  var modeURIs = combo.split('\n');
252
-
253
219
  var _short = modeURIs.map(function (u) {
254
220
  return u.split('#')[1];
255
221
  }).join('');
256
-
257
222
  if (defa && !main) _short += 'Default'; // don't muddle authorizations
258
-
259
223
  var _a = kb.sym(aclDoc.uri + '#' + _short);
260
-
261
224
  kb.add(_a, ns.rdf('type'), ACL('Authorization'), aclDoc);
262
-
263
225
  if (main) {
264
226
  kb.add(_a, ACL('accessTo'), x, aclDoc);
265
227
  }
266
-
267
228
  if (defa) {
268
229
  kb.add(_a, ACL('default'), x, aclDoc);
269
230
  }
270
-
271
231
  for (var i = 0; i < modeURIs.length; i++) {
272
232
  kb.add(_a, ACL('mode'), kb.sym(modeURIs[i]), aclDoc);
273
233
  }
274
-
275
234
  for (var _i = 0; _i < pairs.length; _i++) {
276
235
  var pred = pairs[_i][0];
277
236
  var ag = pairs[_i][1];
@@ -279,23 +238,20 @@ function makeACLGraphbyCombo(kb, x, byCombo, aclDoc, main, defa) {
279
238
  }
280
239
  }
281
240
  }
241
+
282
242
  /**
283
243
  * Debugging short strings for dumping ACL
284
244
  * and possibly in the UI
285
245
  */
286
-
287
-
288
246
  function ACLToString(ac) {
289
247
  return comboToString(ACLbyCombination(ac));
290
248
  }
249
+
291
250
  /**
292
251
  * Convert a [[ComboList]] to a string
293
252
  */
294
-
295
-
296
253
  function comboToString(byCombo) {
297
254
  var str = '';
298
-
299
255
  for (var combo in byCombo) {
300
256
  var modeURIs = combo.split('\n');
301
257
  var initials = modeURIs.map(function (u) {
@@ -303,7 +259,6 @@ function comboToString(byCombo) {
303
259
  }).join('');
304
260
  str += initials + ':';
305
261
  var pairs = byCombo[combo];
306
-
307
262
  for (var i = 0; i < pairs.length; i++) {
308
263
  var pred = pairs[i][0];
309
264
  var ag = (0, _rdflib.sym)(pairs[i][1]);
@@ -311,92 +266,83 @@ function comboToString(byCombo) {
311
266
  str += ag.sameTerm(ns.foaf('Agent')) ? '*' : utils.label(ag);
312
267
  if (i < pairs.length - 1) str += ',';
313
268
  }
314
-
315
269
  str += ';';
316
270
  }
317
-
318
271
  return '{' + str.slice(0, -1) + '}'; // drop extra semicolon
319
272
  }
273
+
320
274
  /**
321
275
  * Write ACL graph as Turtle
322
276
  */
323
-
324
-
325
277
  function makeACLString(x, ac, aclDoc) {
326
278
  var kb2 = (0, _rdflib.graph)();
327
279
  makeACLGraph(kb2, x, ac, aclDoc);
328
280
  return (0, _rdflib.serialize)(aclDoc, kb2, aclDoc.uri, 'text/turtle') || '';
329
281
  }
282
+
330
283
  /**
331
284
  * Write ACL graph to web
332
285
  */
333
-
334
-
335
286
  function putACLObject(kb, x, ac, aclDoc, callbackFunction) {
336
287
  var byCombo = ACLbyCombination(ac);
337
288
  return putACLbyCombo(kb, x, byCombo, aclDoc, callbackFunction);
338
289
  }
290
+
339
291
  /**
340
292
  * Write ACL graph to web from a [[ComboList]]
341
293
  */
342
-
343
-
344
294
  function putACLbyCombo(kb, x, byCombo, aclDoc, callbackFunction) {
345
295
  var _kb$updater;
346
-
347
296
  var kb2 = (0, _rdflib.graph)();
348
- makeACLGraphbyCombo(kb2, x, byCombo, aclDoc, true); // const str = makeACLString = function(x, ac, aclDoc)
297
+ makeACLGraphbyCombo(kb2, x, byCombo, aclDoc, true);
349
298
 
299
+ // const str = makeACLString = function(x, ac, aclDoc)
350
300
  (_kb$updater = kb.updater) === null || _kb$updater === void 0 ? void 0 : _kb$updater.put(aclDoc, kb2.statementsMatching(undefined, undefined, undefined, aclDoc), 'text/turtle', function (uri, ok, message) {
351
301
  if (!ok) {
352
302
  callbackFunction(ok, message);
353
303
  } else {
354
304
  var _kb$fetcher;
355
-
356
305
  (_kb$fetcher = kb.fetcher) === null || _kb$fetcher === void 0 ? void 0 : _kb$fetcher.unload(aclDoc);
357
306
  makeACLGraphbyCombo(kb, x, byCombo, aclDoc, true);
358
307
  kb.fetcher.requested[aclDoc.uri] = 'done'; // missing: save headers
359
-
360
308
  callbackFunction(ok);
361
309
  }
362
310
  });
363
311
  }
364
-
365
312
  /**
366
313
  * Fix the ACl for an individual card as a function of the groups it is in
367
314
  *
368
315
  * All group files must be loaded first
369
316
  */
370
317
  function fixIndividualCardACL(person, log, callbackFunction) {
371
- var groups = kb.each(undefined, ns.vcard('hasMember'), person); // const doc = person.doc()
372
-
318
+ var groups = kb.each(undefined, ns.vcard('hasMember'), person);
319
+ // const doc = person.doc()
373
320
  if (groups) {
374
321
  fixIndividualACL(person, groups, log, callbackFunction);
375
322
  } else {
376
323
  log('This card is in no groups');
377
324
  callbackFunction(true); // fine, no requirements to access. default should be ok
378
- } // @@ if no groups, then use default for People container or the book top container.?
379
-
325
+ }
326
+ // @@ if no groups, then use default for People container or the book top container.?
380
327
  }
328
+
381
329
  /**
382
330
  * This function is used by [[fixIndividualCardACL]]
383
331
  */
384
-
385
-
386
332
  function fixIndividualACL(item, subjects, log, callbackFunction) {
387
333
  log = log || debug.log;
388
334
  var doc = item.doc();
389
335
  getACLorDefault(doc, function (ok, exists, targetDoc, targetACLDoc, defaultHolder, defaultACLDoc) {
390
336
  if (!ok || !defaultHolder || !defaultACLDoc) return callbackFunction(false, targetACLDoc); // ie message
391
-
392
337
  var ac = exists ? readACL(targetDoc, targetACLDoc) : readACL(defaultHolder, defaultACLDoc);
393
338
  loadUnionACL(subjects, function (ok, union) {
394
339
  if (!ok) return callbackFunction(false, union);
395
-
396
340
  if (sameACL(union, ac)) {
397
341
  log('Nice - same ACL. no change ' + utils.label(item) + ' ' + doc);
398
342
  } else {
399
- log('Group ACLs differ for ' + utils.label(item) + ' ' + doc); // log("Group ACLs: " + makeACLString(targetDoc, union, targetACLDoc))
343
+ log('Group ACLs differ for ' + utils.label(item) + ' ' + doc);
344
+
345
+ // log("Group ACLs: " + makeACLString(targetDoc, union, targetACLDoc))
400
346
  // log((exists ? "Previous set" : "Default") + " ACLs: " +
401
347
  // makeACLString(targetDoc, ac, targetACLDoc))
402
348
 
@@ -405,18 +351,15 @@ function fixIndividualACL(item, subjects, log, callbackFunction) {
405
351
  });
406
352
  });
407
353
  }
354
+
408
355
  /**
409
356
  * Set an ACL
410
357
  */
411
-
412
-
413
358
  function setACL(docURI, aclText, callbackFunction) {
414
359
  var aclDoc = kb.any(docURI, _solidLogic.ACL_LINK); // @@ check that this get set by web.js
415
-
416
360
  if (!kb.fetcher) {
417
361
  throw new Error('Store has no fetcher');
418
362
  }
419
-
420
363
  if (aclDoc) {
421
364
  // Great we already know where it is
422
365
  kb.fetcher.webOperation('PUT', aclDoc.value, {
@@ -429,7 +372,6 @@ function setACL(docURI, aclText, callbackFunction) {
429
372
  kb.fetcher.nowOrWhenFetched(docURI, undefined, function (ok, body) {
430
373
  if (!ok) return callbackFunction(ok, 'Gettting headers for ACL: ' + body);
431
374
  var aclDoc = kb.any(docURI, _solidLogic.ACL_LINK); // @@ check that this get set by web.js
432
-
433
375
  if (!aclDoc) {
434
376
  // complainIfBad(false, "No Link rel=ACL header for " + docURI)
435
377
  callbackFunction(false, 'No Link rel=ACL header for ' + docURI);
@@ -437,7 +379,6 @@ function setACL(docURI, aclText, callbackFunction) {
437
379
  if (!kb.fetcher) {
438
380
  throw new Error('Store has no fetcher');
439
381
  }
440
-
441
382
  kb.fetcher.webOperation('PUT', aclDoc.value, {
442
383
  data: aclText,
443
384
  contentType: 'text/turtle'
@@ -448,6 +389,7 @@ function setACL(docURI, aclText, callbackFunction) {
448
389
  });
449
390
  }
450
391
  }
392
+
451
393
  /**
452
394
  * Get ACL file or default if necessary
453
395
  *
@@ -457,25 +399,21 @@ function setACL(docURI, aclText, callbackFunction) {
457
399
  * * `callbackFunction(false, false, status, message)` when there was an error getting the original
458
400
  * * `callbackFunction(false, true, status, message)` when there was an error getting the default
459
401
  */
460
-
461
-
462
402
  function getACLorDefault(doc, callbackFunction) {
463
403
  getACL(doc, function (ok, status, aclDoc, message) {
464
404
  var ACL = ns.acl;
465
- if (!ok) return callbackFunction(false, false, status, message); // Recursively search for the ACL file which gives default access
405
+ if (!ok) return callbackFunction(false, false, status, message);
466
406
 
407
+ // Recursively search for the ACL file which gives default access
467
408
  var tryParent = function tryParent(uri) {
468
409
  if (uri.slice(-1) === '/') {
469
410
  uri = uri.slice(0, -1);
470
411
  }
471
-
472
412
  var right = uri.lastIndexOf('/');
473
413
  var left = uri.indexOf('/', uri.indexOf('//') + 2);
474
-
475
414
  if (left > right) {
476
415
  return callbackFunction(false, true, 404, 'Found no ACL resource');
477
416
  }
478
-
479
417
  uri = uri.slice(0, right + 1);
480
418
  var doc2 = (0, _rdflib.sym)(uri);
481
419
  getACL(doc2, function (ok, status, defaultACLDoc) {
@@ -487,12 +425,10 @@ function getACLorDefault(doc, callbackFunction) {
487
425
  return tryParent(uri);
488
426
  } else if (status !== 200) {
489
427
  return callbackFunction(false, true, status, "Error status '".concat(status, "' searching for default for ").concat(doc2));
490
- } // 200
428
+ }
429
+ // 200
491
430
  // statusBlock.textContent += (" ACCESS set at " + uri + ". End search.")
492
-
493
-
494
431
  var defaults = kb.each(undefined, ACL('default'), kb.sym(uri), defaultACLDoc).concat(kb.each(undefined, ACL('defaultForNew'), kb.sym(uri), defaultACLDoc));
495
-
496
432
  if (!defaults.length) {
497
433
  return tryParent(uri); // Keep searching
498
434
  }
@@ -502,7 +438,6 @@ function getACLorDefault(doc, callbackFunction) {
502
438
  });
503
439
  }; // tryParent
504
440
 
505
-
506
441
  if (!ok) {
507
442
  return callbackFunction(false, false, status, "Error accessing Access Control information for ".concat(doc, ") ").concat(message));
508
443
  } else if (status === 404) {
@@ -517,6 +452,7 @@ function getACLorDefault(doc, callbackFunction) {
517
452
  }
518
453
  }); // Call to getACL
519
454
  }
455
+
520
456
  /**
521
457
  * Calls back `(ok, status, acldoc, message)` as follows
522
458
  *
@@ -525,31 +461,24 @@ function getACLorDefault(doc, callbackFunction) {
525
461
  * * `(true, 404, documentSymbol, fileaccesserror)` if does not exist
526
462
  * * `(true, 200, documentSymbol)` if file exists and read OK
527
463
  */
528
-
529
-
530
464
  function getACL(doc, callbackFunction) {
531
465
  if (!kb.fetcher) {
532
466
  throw new Error('kb has no fetcher');
533
467
  }
534
-
535
468
  kb.fetcher.nowOrWhenFetched(doc, undefined, function (ok, body) {
536
469
  if (!ok) {
537
470
  return callbackFunction(ok, "Can't get headers to find ACL for ".concat(doc, ": ").concat(body));
538
471
  }
539
-
540
472
  var aclDoc = kb.any(doc, _solidLogic.ACL_LINK); // @@ check that this get set by web.js
541
-
542
473
  if (!aclDoc) {
543
474
  callbackFunction(false, 900, "No Link rel=ACL header for ".concat(doc));
544
475
  } else {
545
476
  if (!kb.fetcher) {
546
477
  throw new Error('kb has no fetcher');
547
478
  }
548
-
549
479
  if (kb.fetcher.nonexistent[aclDoc.value]) {
550
480
  return callbackFunction(true, 404, aclDoc, "ACL file ".concat(aclDoc, " does not exist."));
551
481
  }
552
-
553
482
  kb.fetcher.nowOrWhenFetched(aclDoc, undefined, function (ok, message, response) {
554
483
  if (!ok) {
555
484
  callbackFunction(true, response.status, aclDoc, "Can't read Access Control File ".concat(aclDoc, ": ").concat(message));
@@ -560,15 +489,13 @@ function getACL(doc, callbackFunction) {
560
489
  }
561
490
  });
562
491
  }
492
+
563
493
  /**
564
494
  * Calls [[getACLorDefault]] and then (?)
565
495
  */
566
-
567
-
568
496
  function getProspectiveHolder(_x) {
569
497
  return _getProspectiveHolder.apply(this, arguments);
570
498
  }
571
-
572
499
  function _getProspectiveHolder() {
573
500
  _getProspectiveHolder = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(targetDirectory) {
574
501
  return _regenerator["default"].wrap(function _callee$(_context) {
@@ -580,11 +507,9 @@ function _getProspectiveHolder() {
580
507
  if (ok) {
581
508
  return resolve(isDirectACL ? targetDoc : defaultHolder);
582
509
  }
583
-
584
510
  return reject(new Error("Error loading ".concat(targetDirectory)));
585
511
  });
586
512
  }));
587
-
588
513
  case 1:
589
514
  case "end":
590
515
  return _context.stop();