not-node 6.3.66 → 6.3.67
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.
package/package.json
CHANGED
package/src/generic/logic.js
CHANGED
|
@@ -349,7 +349,12 @@ module.exports = ({
|
|
|
349
349
|
if (!itm) {
|
|
350
350
|
throw new DBExceptionDocumentIsNotFound();
|
|
351
351
|
}
|
|
352
|
-
if (
|
|
352
|
+
if (
|
|
353
|
+
shouldOwn &&
|
|
354
|
+
identity &&
|
|
355
|
+
identity?.uid &&
|
|
356
|
+
!isOwner(itm, identity.uid)
|
|
357
|
+
) {
|
|
353
358
|
throw new DBExceptionDocumentIsNotOwnerByActiveUser({
|
|
354
359
|
params: {
|
|
355
360
|
targetId,
|
|
@@ -447,12 +452,12 @@ module.exports = ({
|
|
|
447
452
|
shouldOwn = false,
|
|
448
453
|
}) {
|
|
449
454
|
logDebugAction(action, identity);
|
|
450
|
-
|
|
455
|
+
let { skip, size, sorter, filter, search } = query;
|
|
451
456
|
let populate = await getPopulate(action, {
|
|
452
457
|
identity,
|
|
453
458
|
});
|
|
454
459
|
if (shouldOwn) {
|
|
455
|
-
notFilter.filter.modifyRules(filter, {
|
|
460
|
+
filter = notFilter.filter.modifyRules(filter, {
|
|
456
461
|
[ownerFieldName]: identity?.uid,
|
|
457
462
|
});
|
|
458
463
|
}
|
|
@@ -489,12 +494,12 @@ module.exports = ({
|
|
|
489
494
|
|
|
490
495
|
static async _list({ query, identity, action, shouldOwn = false }) {
|
|
491
496
|
logDebugAction(action, identity);
|
|
492
|
-
|
|
497
|
+
let { skip, size, sorter, filter } = query;
|
|
493
498
|
let populate = await getPopulate(action, {
|
|
494
499
|
identity,
|
|
495
500
|
});
|
|
496
501
|
if (shouldOwn) {
|
|
497
|
-
notFilter.filter.modifyRules(filter, {
|
|
502
|
+
filter = notFilter.filter.modifyRules(filter, {
|
|
498
503
|
[ownerFieldName]: identity?.uid,
|
|
499
504
|
});
|
|
500
505
|
}
|
|
@@ -529,14 +534,14 @@ module.exports = ({
|
|
|
529
534
|
|
|
530
535
|
static async _count({ query, action, identity, shouldOwn = false }) {
|
|
531
536
|
logDebugAction(action, identity);
|
|
532
|
-
|
|
537
|
+
let { filter, search } = query;
|
|
533
538
|
if (shouldOwn) {
|
|
534
|
-
notFilter.filter.modifyRules(filter, {
|
|
539
|
+
filter = notFilter.filter.modifyRules(filter, {
|
|
535
540
|
[ownerFieldName]: identity?.uid,
|
|
536
541
|
});
|
|
537
542
|
}
|
|
538
543
|
if (search) {
|
|
539
|
-
notFilter.filter.modifyRules(search, filter);
|
|
544
|
+
filter = notFilter.filter.modifyRules(search, filter);
|
|
540
545
|
}
|
|
541
546
|
const result = await getModel().countWithFilter(search || filter);
|
|
542
547
|
LogAction(action, identity, { shouldOwn });
|
|
@@ -18,13 +18,13 @@ module.exports = class OwnageBeforeAction {
|
|
|
18
18
|
if (identity.uid) {
|
|
19
19
|
//if searching, counting, listing and so on
|
|
20
20
|
//adding condition of ownership by this excat user
|
|
21
|
-
|
|
21
|
+
let { filter, search } = query;
|
|
22
22
|
if (filter) {
|
|
23
|
-
notFilter.filter.modifyRules(filter, {
|
|
23
|
+
filter = notFilter.filter.modifyRules(filter, {
|
|
24
24
|
[OwnageBeforeAction.ownerFieldName]: identity?.uid,
|
|
25
25
|
});
|
|
26
26
|
if (search) {
|
|
27
|
-
notFilter.filter.modifyRules(search, filter);
|
|
27
|
+
search = notFilter.filter.modifyRules(search, filter);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
args.defaultQueryById = {
|